Skip to content

Commit

Permalink
DYN-7143 Skip install for npm packages which are already up-to-date (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
zeusongit authored Jun 17, 2024
1 parent df3a852 commit 0330977
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 12 deletions.
28 changes: 22 additions & 6 deletions src/DynamoCoreWpf/DynamoCoreWpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,21 @@
</PropertyGroup>

<Target Name="NpmRunBuild" BeforeTargets="BeforeBuild">
<PropertyGroup>
<PackageVersion>1.0.19</PackageVersion>
<PackageName>SplashScreen</PackageName>
</PropertyGroup>
<Exec Command="$(PowerShellCommand) -ExecutionPolicy ByPass -Command echo ($(SolutionDir)\pkgexist.ps1 $(PackageName) $(PackageVersion))" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="ShouldInstall" />
</Exec>
<Message Text="Skipping Install for $(PackageName) $(PackageVersion), package up to date." Condition="!$(ShouldInstall)" Importance="high" />
<!--This command updates the npm registry configuration if necessary-->
<Exec Command="$(PowerShellCommand) -ExecutionPolicy ByPass -Command $(SolutionDir)\setnpmreg.ps1" />
<Exec Command="$(PowerShellCommand) -ExecutionPolicy ByPass -Command $(SolutionDir)\setnpmreg.ps1" Condition="$(ShouldInstall)"/>
<!--This command gets a specific splash screen build from npm-->
<Exec Command="npm pack @dynamods/splash-screen@1.0.19" />
<Exec Command="npm pack @dynamods/splash-screen@$(PackageVersion)" Condition="$(ShouldInstall)"/>
</Target>

<Target Name="ExtractTGZFile" DependsOnTargets="NpmRunBuild" BeforeTargets="BeforeBuild">
<Target Name="ExtractTGZFile" DependsOnTargets="NpmRunBuild" BeforeTargets="BeforeBuild" Condition="$(ShouldInstall)">
<!--Locates the .tgz files-->
<ItemGroup>
<TGZFiles Include="./dynamods-splash-screen-*.tgz" />
Expand All @@ -50,13 +58,21 @@


<Target Name="NpmRunBuildHomePage" BeforeTargets="BeforeBuild">
<PropertyGroup>
<PackageVersion>1.0.14</PackageVersion>
<PackageName>DynamoHome</PackageName>
</PropertyGroup>
<Exec Command="$(PowerShellCommand) -ExecutionPolicy ByPass -Command echo ($(SolutionDir)\pkgexist.ps1 $(PackageName) $(PackageVersion))" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="ShouldInstall" />
</Exec>
<Message Text="Skipping Install for $(PackageName) $(PackageVersion), package up to date." Condition="!$(ShouldInstall)" Importance="high"></Message>
<!--This command updates the npm registry configuration if necessary-->
<Exec Command="$(PowerShellCommand) -ExecutionPolicy ByPass -Command $(SolutionDir)\setnpmreg.ps1" />
<Exec Command="$(PowerShellCommand) -ExecutionPolicy ByPass -Command $(SolutionDir)\setnpmreg.ps1" Condition="$(ShouldInstall)"/>
<!--Download a specific build of the Dynamo Home package from npm-->
<Exec Command="npm pack @dynamods/[email protected]" />
<Exec Command="npm pack @dynamods/[email protected]" Condition="$(ShouldInstall)"/>
</Target>

<Target Name="ExtractTGZFileDynamoHome" DependsOnTargets="NpmRunBuildHomePage" BeforeTargets="BeforeBuild">
<Target Name="ExtractTGZFileDynamoHome" DependsOnTargets="NpmRunBuildHomePage" BeforeTargets="BeforeBuild" Condition="$(ShouldInstall)">
<!--Locate the .tgz files for the Dynamo Home package-->
<ItemGroup>
<TGZFilesDynamoHome Include="./dynamods-dynamo-home-*.tgz" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,21 @@
</PropertyGroup>

<Target Name="NpmRunBuild" BeforeTargets="BeforeBuild">
<PropertyGroup>
<PackageVersion>1.0.5</PackageVersion>
<PackageName>LibrarieJS</PackageName>
</PropertyGroup>
<Exec Command="$(PowerShellCommand) -ExecutionPolicy ByPass -Command echo ($(SolutionDir)\pkgexist.ps1 $(PackageName) $(PackageVersion))" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="ShouldInstall" />
</Exec>
<Message Text="Skipping Install for $(PackageName) $(PackageVersion), package up to date." Condition="!$(ShouldInstall)" Importance="high"></Message>
<!--This command updates the npm registry configuration if necessary-->
<Exec Command="$(PowerShellCommand) -ExecutionPolicy ByPass -Command $(SolutionDir)\setnpmreg.ps1" />
<Exec Command="$(PowerShellCommand) -ExecutionPolicy ByPass -Command $(SolutionDir)\setnpmreg.ps1" Condition="$(ShouldInstall)"/>
<!--This command gets a specific build of the notifcation center from npm-->
<Exec Command="npm pack @dynamods/librariejs@1.0.5" />
<Exec Command="npm pack @dynamods/librariejs@$(PackageVersion)" Condition="$(ShouldInstall)"/>
</Target>

<Target Name="ExtractTGZFile" BeforeTargets="BeforeBuild">
<Target Name="ExtractTGZFile" BeforeTargets="BeforeBuild" Condition="$(ShouldInstall)">
<!--Locates the .tgz files-->
<ItemGroup>
<TGZFiles Include="./dynamods-librariejs-*.tgz" />
Expand Down
15 changes: 12 additions & 3 deletions src/Notifications/Notifications.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,22 @@
</PropertyGroup>

<Target Name="NpmRunBuild" BeforeTargets="BeforeBuild">
<PropertyGroup>
<PackageVersion>0.0.29</PackageVersion>
<PackageName>NotificationCenter</PackageName>
</PropertyGroup>
<Exec Command="$(PowerShellCommand) -ExecutionPolicy ByPass -Command echo ($(SolutionDir)\pkgexist.ps1 $(PackageName) $(PackageVersion))" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="ShouldInstall" />
</Exec>
<Message Text="Skipping Install for $(PackageName) $(PackageVersion), package up to date." Condition="!$(ShouldInstall)" Importance="high"></Message>

<!--This command updates the npm registry configuration if necessary-->
<Exec Command="$(PowerShellCommand) -ExecutionPolicy ByPass -Command $(SolutionDir)\setnpmreg.ps1" />
<Exec Command="$(PowerShellCommand) -ExecutionPolicy ByPass -Command $(SolutionDir)\setnpmreg.ps1" Condition="$(ShouldInstall)"/>
<!--This command gets a specific build of the notifcation center from npm-->
<Exec Command="npm pack @dynamods/notifications-center@0.0.29" />
<Exec Command="npm pack @dynamods/notifications-center@$(PackageVersion)" Condition="$(ShouldInstall)"/>
</Target>

<Target Name="ExtractTGZFile" BeforeTargets="BeforeBuild">
<Target Name="ExtractTGZFile" BeforeTargets="BeforeBuild" Condition="$(ShouldInstall)">
<!--Locates the .tgz files-->
<ItemGroup>
<TGZFiles Include="./dynamods-notifications-center-*.tgz" />
Expand Down
15 changes: 15 additions & 0 deletions src/pkgexist.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
$pkgname=$args[0]
$pkgver=$args[1]

If ((-Not (Test-Path .\Packages\$pkgname)) -Or (-Not (Test-Path .\Packages\$pkgname\package.json))) {
echo true
return
}

$currver=(Get-Content .\Packages\$pkgname\package.json | ConvertFrom-Json).version
If ($currver -ne $pkgver) {
echo true
}
else {
echo false
}

0 comments on commit 0330977

Please sign in to comment.