win/msi: make npm a feature separate from the runtime
authorBert Belder <bertbelder@gmail.com>
Thu, 7 Mar 2013 10:55:47 +0000 (11:55 +0100)
committerBert Belder <bertbelder@gmail.com>
Fri, 8 Mar 2013 17:00:36 +0000 (18:00 +0100)
tools/msvs/msi/nodemsi.wixproj
tools/msvs/msi/product.wxs

index b1ecbdb..891291d 100644 (file)
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
     <OutputPath>..\..\..\$(Configuration)\</OutputPath>
     <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
-    <DefineConstants>Debug;ProductVersion=$(NodeVersion);NoETW=$(NoETW);NoPerfCtr=$(NoPerfCtr);NPMSourceDir=..\..\..\deps\npm\;ProgramFilesFolderId=ProgramFilesFolder</DefineConstants>
+    <DefineConstants>Debug;ProductVersion=$(NodeVersion);NoETW=$(NoETW);NoPerfCtr=$(NoPerfCtr);NpmSourceDir=..\..\..\deps\npm\;ProgramFilesFolderId=ProgramFilesFolder</DefineConstants>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
     <OutputPath>..\..\..\$(Configuration)\</OutputPath>
     <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
-    <DefineConstants>Debug;ProductVersion=$(NodeVersion);NoETW=$(NoETW);NoPerfCtr=$(NoPerfCtr);NPMSourceDir=..\..\..\deps\npm\;ProgramFilesFolderId=ProgramFilesFolder</DefineConstants>
+    <DefineConstants>Debug;ProductVersion=$(NodeVersion);NoETW=$(NoETW);NoPerfCtr=$(NoPerfCtr);NpmSourceDir=..\..\..\deps\npm\;ProgramFilesFolderId=ProgramFilesFolder</DefineConstants>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
     <OutputPath>..\..\..\$(Configuration)\</OutputPath>
     <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
-    <DefineConstants>Debug;ProductVersion=$(NodeVersion);NoETW=$(NoETW);NoPerfCtr=$(NoPerfCtr);NPMSourceDir=..\..\..\deps\npm\;ProgramFilesFolderId=ProgramFiles64Folder</DefineConstants>
+    <DefineConstants>Debug;ProductVersion=$(NodeVersion);NoETW=$(NoETW);NoPerfCtr=$(NoPerfCtr);NpmSourceDir=..\..\..\deps\npm\;ProgramFilesFolderId=ProgramFiles64Folder</DefineConstants>
     <Cultures>en-US</Cultures>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
     <OutputPath>..\..\..\$(Configuration)\</OutputPath>
     <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
-    <DefineConstants>Debug;ProductVersion=$(NodeVersion);NoETW=$(NoETW);NoPerfCtr=$(NoPerfCtr);NPMSourceDir=..\..\..\deps\npm\;ProgramFilesFolderId=ProgramFiles64Folder</DefineConstants>
+    <DefineConstants>Debug;ProductVersion=$(NodeVersion);NoETW=$(NoETW);NoPerfCtr=$(NoPerfCtr);NpmSourceDir=..\..\..\deps\npm\;ProgramFilesFolderId=ProgramFiles64Folder</DefineConstants>
   </PropertyGroup>
   <PropertyGroup>
     <EnableProjectHarvesting>True</EnableProjectHarvesting>
@@ -58,7 +58,7 @@
   </ItemGroup>
   <Import Project="$(WixTargetsPath)" />
   <Target Name="BeforeBuild">
-    <HeatDirectory ToolPath="$(WixToolPath)" Directory="..\..\..\deps\npm" PreprocessorVariable="var.NPMSourceDir" DirectoryRefId="NodeModulesFolder" ComponentGroupName="NPMFiles" GenerateGuidsNow="true" SuppressFragments="false" OutputFile="..\..\..\npm.wxs">
+    <HeatDirectory ToolPath="$(WixToolPath)" Directory="..\..\..\deps\npm" PreprocessorVariable="var.NpmSourceDir" DirectoryRefId="NodeModulesFolder" ComponentGroupName="NpmSourceFiles" GenerateGuidsNow="true" SuppressFragments="false" OutputFile="..\..\..\npm.wxs">
     </HeatDirectory>
   </Target>
   <PropertyGroup>
index 891bc44..2faaccf 100755 (executable)
       <ComponentGroupRef Id="Product.Generated" />
     </Feature>
 
+    <Feature Id="npm"
+             Level="1"
+             Title="NPM package manager"
+             Description="Install NPM, the recommended package manager for Node.js.">
+      <ComponentRef Id="NpmCmdScript"/>
+      <ComponentRef Id="NpmBashScript"/>
+      <ComponentRef Id="NpmConfigurationFile"/>
+      <ComponentGroupRef Id="NpmSourceFiles"/>
+    </Feature>
+
     <Feature Id="nodejs.shortcuts" Title="node.js shortcuts" Level="1" Description="$(var.ProductDescription) Shortcuts">
       <Feature Id="nodejs.shortcuts.application" Title="Application Shortcuts" Level="1"  Description="$(var.ProductDescription) standard application shortcuts">
         <ComponentGroupRef Id="application.shortcuts"/>
 
       <Directory Id="$(var.ProgramFilesFolderId)">
         <Directory Id="INSTALLDIR" Name="nodejs">
-          <Directory Id="NodeModulesFolder" Name="node_modules">
-            <Directory Id="NPMFolder" Name="npm">
-              <Component Id="npmrc" Guid="55B2B03F-8F32-4D62-A54A-FA428615591D">
-                 <File Id="filenpmrc" KeyPath="yes" Source="$(var.RepoDir)\tools\msvs\npm\npmrc" />
-              </Component>
-            </Directory>
-          </Directory>
           <Component Id="nodeexe" Guid="AEC0F08E-89B3-4C35-A286-8DB8598597F2">
             <File Id="filenodeexe" KeyPath="yes" Source="$(var.SourceDir)\node.exe" />
             <?if $(var.NoETW) != 1 ?>
                          System="yes"
                          Value="[INSTALLDIR]" />
           </Component>
-          <Component Id="npmcmd" Guid="31e9986d-74cd-44e1-878c-194d3e997d32">
-            <File Id="filenpmcmd" KeyPath="yes" Source="$(var.NPMSourceDir)\bin\npm.cmd" />
-          </Component>
-          <Component Id="npmsh" Guid="57754e12-9269-4198-a38c-2c098bf5276e">
-            <File Id="filenpmsh" KeyPath="yes" Source="$(var.NPMSourceDir)\bin\npm" />
-          </Component>
           <Component Id="nodejsvars" Guid="*">
             <File Id="filenodejsvars" KeyPath="yes" Source="$(var.RepoDir)\tools\msvs\nodejsvars.bat" />
           </Component>
       </Directory>
     </Directory>
 
+    <DirectoryRef Id="INSTALLDIR">
+      <Component Id="NpmCmdScript">
+        <File Id="npm.cmd" KeyPath="yes" Source="$(var.NpmSourceDir)\bin\npm.cmd"/>
+      </Component>
+
+      <Component Id="NpmBashScript">
+        <File Id="npm.sh" KeyPath="yes" Source="$(var.NpmSourceDir)\bin\npm"/>
+      </Component>
+
+      <Directory Id="NodeModulesFolder" Name="node_modules">
+        <Directory Id="NpmFolder" Name="npm">
+          <Component Id="NpmConfigurationFile">
+            <File Id="npm.rc" KeyPath="yes" Source="$(var.RepoDir)\tools\msvs\npm\npmrc"/>
+          </Component>
+        </Directory>
+      </Directory>
+    </DirectoryRef>
+
     <DirectoryRef Id="ApplicationProgramsFolder">
       <Component Id="ApplicationShortcut" Guid="9b1ab94a-8f54-4f19-a5c4-b890de474162">
         <Shortcut Id="ApplicationStartMenuShortcut" Name="Node.js"
 
     <ComponentGroup Id="allfiles">
       <ComponentRef Id="nodeexe"/>
-      <ComponentRef Id="npmcmd"/>
-      <ComponentRef Id="npmsh"/>
-      <ComponentRef Id="npmrc" />
-      <ComponentGroupRef Id="NPMFiles" />
       <ComponentRef Id="nodejsvars" />
       <ComponentRef Id="noderegistry" />
     </ComponentGroup>