Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DYN-7143 Skip install for npm packages which are already up-to-date #15316

Merged
merged 3 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)) {
echo true
return
}

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