Skip to content

Instantly share code, notes, and snippets.

@ry

ry/npm-msi.patch Secret

Created November 23, 2011 00:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ry/063fe772827efd3f2428 to your computer and use it in GitHub Desktop.
Save ry/063fe772827efd3f2428 to your computer and use it in GitHub Desktop.
From ea88b5d55e38d011d3a609c868a180a288583073 Mon Sep 17 00:00:00 2001
From: Ryan Dahl <ry@tinyclouds.org>
Date: Tue, 22 Nov 2011 16:10:32 -0800
Subject: [PATCH] WIP. Support installing npm in the .msi
---
.gitignore | 2 ++
tools/msvs/msi/nodemsi.wixproj | 8 +++++++-
tools/msvs/msi/product.wxs | 2 ++
vcbuild.bat | 1 +
4 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/.gitignore b/.gitignore
index 2b27112..4851304 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,3 +34,5 @@ ipch/
*-nodegyp*
/gyp-mac-tool
/dist-osx
+/npm.wxs
+/tools/msvs/npm.wixobj
diff --git a/tools/msvs/msi/nodemsi.wixproj b/tools/msvs/msi/nodemsi.wixproj
index 8ac7a3e..4936d30 100644
--- a/tools/msvs/msi/nodemsi.wixproj
+++ b/tools/msvs/msi/nodemsi.wixproj
@@ -1,4 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
+
+<?define sourcedir="$(var.ProjectDir)..\..\..\$(var.Configuration)\" ?>
+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -11,6 +14,7 @@
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
<NodeVersion Condition=" '$(NodeVersion)' == '' ">0.0.0.0</NodeVersion>
+ <NPMSourceDir>..\..\..\$(Configuration)\deps\npm</NPMSourceDir>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>..\..\..\$(Configuration)\</OutputPath>
@@ -24,6 +28,7 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="product.wxs" />
+ <Compile Include="..\..\..\npm.wxs" />
</ItemGroup>
<ItemGroup>
<WixExtension Include="WixUIExtension">
@@ -36,8 +41,9 @@
To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Wix.targets.
<Target Name="BeforeBuild">
+ <Exec Command="heat dir ".\deps\npm" -gg -sfrag -cg NPMFiles -template fragm ent -out npm.wxs">
</Target>
<Target Name="AfterBuild">
</Target>
-->
-</Project>
\ No newline at end of file
+</Project>
diff --git a/tools/msvs/msi/product.wxs b/tools/msvs/msi/product.wxs
index e3fa2ec..d32b94b 100644
--- a/tools/msvs/msi/product.wxs
+++ b/tools/msvs/msi/product.wxs
@@ -17,6 +17,7 @@
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="NodeRoot" Name="nodejs">
+ <Directory Id="NodeModulesFolder" Name="node_modules" />
<Component Id="nodeexe" Guid="AEC0F08E-89B3-4C35-A286-8DB8598597F2">
<File Id="filenodeexe" KeyPath="yes" Source="$(var.sourcedir)\node.exe" />
<Environment Id="Environment"
@@ -37,6 +38,7 @@
<ComponentGroup Id="allfiles">
<ComponentRef Id="nodeexe"/>
+ <ComponentGroupRef Id="NPMFiles" />
<?if $(var.Configuration) = Debug ?>
<ComponentRef Id="nodepdb"/>
<?endif?>
diff --git a/vcbuild.bat b/vcbuild.bat
index 709d71c..eb7a596 100644
--- a/vcbuild.bat
+++ b/vcbuild.bat
@@ -83,6 +83,7 @@ if not defined msi goto run
python "%~dp0tools\getnodeversion.py" > "%temp%\node_version.txt"
if not errorlevel 0 echo Cannot determine current version of node.js & goto exit
for /F "tokens=*" %%i in (%temp%\node_version.txt) do set NODE_VERSION=%%i
+heat dir ".\deps\npm" -var var.NPMSourceDir -dr NodeModulesFolder -cg NPMFiles -gg -template fragment -out npm.wxs
msbuild "%~dp0tools\msvs\msi\nodemsi.sln" /t:Clean,Build /p:Configuration=%config% /p:NodeVersion=%NODE_VERSION% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
if errorlevel 1 goto exit
--
1.7.6.msysgit.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment