Skip to content

Commit

Permalink
DYN-5405 npm pack dependencies (#13599)
Browse files Browse the repository at this point in the history
* build and extract files

* splash screen config

* build files notification center

* Files configuration

* remove test code

* adding comments

* removing the the file after extracting

* retrigger checks

* Inserting depends on target property

* full file path

* Adding commands to test self-service job

* adding tar.exe file in the project

* x64 executable

* tar from libarchive

* retrigger checks

* including 7zip

* adding 7zip NotificationCenter

* adding extra messages and -v for the tar command

* Removing 7zip binaries and adding nuget package

* show executables from system 32

* print hostnamo and %path%

* printing dir \a

* printing sysnative folder

* set PreferredToolArchitecture to x64

* testing tar again

* update html string

* Removing 7zip from ignore file

* adding subfolders depending on the name of the packages

* fix unit test

* retrigger checks

* merge from master
  • Loading branch information
filipeotero authored Feb 2, 2023
1 parent 99f6f20 commit 2cec940
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 29 deletions.
12 changes: 4 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,7 @@ test/core/customast/test.txt
test/core/files/test.png
test/core/migration/writetext.txt
logo.png
/src/Notifications/node_modules
/src/Notifications/package.json
/src/Notifications/package-lock.json
/src/Notifications/.npm-cache
/src/DynamoCoreWpf/node_modules
/src/DynamoCoreWpf/package-lock.json
/src/DynamoCoreWpf/package.json
/src/DynamoCoreWpf/.npm-cache
/src/DynamoCoreWpf/Packages
dynamods-splash-screen-*.tgz
/src/Notifications/Packages
/src/Notifications/dynamods-notifications-center-*.tgz
2 changes: 1 addition & 1 deletion extern/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# override specific package dlls#
###################
!*.dll
!*.dll
38 changes: 33 additions & 5 deletions src/DynamoCoreWpf/DynamoCoreWpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,50 @@
<DocumentationFile>$(OutputPath)\DynamoCoreWpf.XML</DocumentationFile>
<EnableDefaultCompileItems>False</EnableDefaultCompileItems>
<EnableDefaultEmbeddedResourceItems>False</EnableDefaultEmbeddedResourceItems>
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
</PropertyGroup>

<Target Name="NpmRunBuild" BeforeTargets="BeforeBuild">
<Exec Command="npm install --prefix ./ @dynamods/splash-screen@latest" />
<!--This command gets the latest build from the splash screen-->
<Exec Command="npm pack @dynamods/splash-screen@latest" />
</Target>

<Target Name="ExtractTGZFile" DependsOnTargets="NpmRunBuild" BeforeTargets="BeforeBuild">
<!--Locates the .tgz files-->
<ItemGroup>
<TGZFiles Include="./dynamods-splash-screen-*.tgz" />
</ItemGroup>

<!--Reverse the order of the files to get the higher version-->
<ItemGroup>
<Reversed Include="@(TGZFiles-&gt;Reverse())" />
</ItemGroup>

<PropertyGroup>
<Last>%(TGZFiles.Filename)</Last>
</PropertyGroup>

<!--Creates the folder for the package-->
<MakeDir Directories="Packages/SplashScreen" />

<!--Extracts the file to /package-->
<Exec Command="tar -xzf $(MSBuildProjectDirectory)\$(Last).tgz --strip-components=1 --directory=Packages/SplashScreen"></Exec>

<!--Deletes the tgz file-->
<Delete Files="$(MSBuildProjectDirectory)\$(Last).tgz" />
</Target>

<ItemGroup>
<None Remove="node_modules\%40dynamods\splash-screen\build\index.bundle.js" />
<None Remove="node_modules\%40dynamods\splash-screen\build\index.html" />
<None Remove="Packages\SplashScreen\build\index.bundle.js" />
<None Remove="Packages\SplashScreen\build\index.html" />
<None Remove="UI\Images\Canvas\canvas-button-geometry-scaling.png" />
<None Remove="Views\Core\GeometryScalingPopup.xaml" />
<None Remove="UI\Images\question-hover-blue-16px.png" />
<None Remove="Views\SplashScreen\WebApp\splashScreenBackground.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="node_modules\@dynamods\splash-screen\build\index.bundle.js" />
<EmbeddedResource Include="node_modules\@dynamods\splash-screen\build\index.html" />
<EmbeddedResource Include="Packages\SplashScreen\build\index.bundle.js" />
<EmbeddedResource Include="Packages\SplashScreen\build\index.html" />
<EmbeddedResource Include="Views\SplashScreen\WebApp\splashScreenBackground.png" />
</ItemGroup>

Expand Down
6 changes: 3 additions & 3 deletions src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ namespace Dynamo.UI.Views
public partial class SplashScreen : Window
{
// These are hardcoded string and should only change when npm package structure changed or image path changed
private static readonly string htmlEmbeddedFile = "Dynamo.Wpf.node_modules._dynamods.splash_screen.build.index.html";
private static readonly string jsEmbeddedFile = "Dynamo.Wpf.node_modules._dynamods.splash_screen.build.index.bundle.js";
private static readonly string htmlEmbeddedFile = "Dynamo.Wpf.Packages.SplashScreen.build.index.html";
private static readonly string jsEmbeddedFile = "Dynamo.Wpf.Packages.SplashScreen.build.index.bundle.js";
private static readonly string backgroundImage = "Dynamo.Wpf.Views.SplashScreen.WebApp.splashScreenBackground.png";
private static readonly string imageFileExtension = "png";

Expand Down Expand Up @@ -274,7 +274,7 @@ protected override async void OnContentRendered(EventArgs e)
webView.CoreWebView2.Settings.IsZoomControlEnabled = false;

var assembly = Assembly.GetExecutingAssembly();

using (Stream stream = assembly.GetManifestResourceStream(htmlEmbeddedFile))
using (StreamReader reader = new StreamReader(stream))
{
Expand Down
4 changes: 2 additions & 2 deletions src/Notifications/NotificationCenterController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public class NotificationCenterController
private static readonly int notificationPopupVerticalOffset = 5;
private static readonly int limitOfMonthsFilterNotifications = 6;

private static readonly string htmlEmbeddedFile = "Dynamo.Notifications.node_modules._dynamods.notifications_center.build.index.html";
private static readonly string jsEmbeddedFile = "Dynamo.Notifications.node_modules._dynamods.notifications_center.build.index.bundle.js";
private static readonly string htmlEmbeddedFile = "Dynamo.Notifications.Packages.NotificationCenter.build.index.html";
private static readonly string jsEmbeddedFile = "Dynamo.Notifications.Packages.NotificationCenter.build.index.bundle.js";
private static readonly string NotificationCenterButtonName = "notificationsButton";
internal DirectoryInfo webBrowserUserDataFolder;

Expand Down
44 changes: 36 additions & 8 deletions src/Notifications/Notifications.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<ImportGroup Label="PropertySheets">
<Import Project="$(SolutionDir)Config\CS_SDK.props" />
</ImportGroup>
Expand All @@ -10,18 +10,46 @@
<AssemblyName>Notifications</AssemblyName>
</PropertyGroup>

<Target Name="NpmRunBuild" BeforeTargets="BeforeBuild">
<Exec Command="npm install --prefix ./ @dynamods/notifications-center@latest" />
</Target>
<Target Name="NpmRunBuild" BeforeTargets="BeforeBuild">
<!--This command gets the latest build from the notifcation center-->
<Exec Command="npm pack @dynamods/notifications-center@latest" />
</Target>

<Target Name="ExtractTGZFile" BeforeTargets="BeforeBuild">
<!--Locates the .tgz files-->
<ItemGroup>
<TGZFiles Include="./dynamods-notifications-center-*.tgz" />
</ItemGroup>

<!--Reverse the order of the files to get the higher version-->
<ItemGroup>
<Reversed Include="@(TGZFiles-&gt;Reverse())" />
</ItemGroup>

<!--Gets the last one-->
<PropertyGroup>
<Last>%(TGZFiles.Filename)</Last>
</PropertyGroup>

<!--Creates the folder for the package-->
<MakeDir Directories="Packages/NotificationCenter" />

<!--Extracts the file to /package-->
<Exec Command="tar -xzf $(MSBuildProjectDirectory)\$(Last).tgz --strip-components=1 --directory=Packages/NotificationCenter"></Exec>

<!--Deletes the tgz file-->
<Delete Files=" $(MSBuildProjectDirectory)\$(Last).tgz" />
</Target>


<ItemGroup>
<None Remove="node_modules\%40dynamods\package.json" />
<None Remove="node_modules\%40dynamods\README.md" />
<None Remove="package\package.json" />
<None Remove="package\README.md" />
<None Remove="View\NotificationUI.xaml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="node_modules\@dynamods\notifications-center\build\index.bundle.js" />
<EmbeddedResource Include="node_modules\@dynamods\notifications-center\build\index.html" />
<EmbeddedResource Include="Packages\NotificationCenter\build\index.bundle.js" />
<EmbeddedResource Include="Packages\NotificationCenter\build\index.html" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FontAwesome.WPF" Version="4.7.0.9" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Dynamo.Utilities;
using Dynamo.Utilities;
using Dynamo.Notifications.View;
using NUnit.Framework;
using System;
Expand Down Expand Up @@ -36,7 +36,7 @@ public void PressNotificationButtonAndShowPopup()
public void ValidateNotificationsUIEmbededFiles()
{
var assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(x=>x.ManifestModule.Name.Contains("Notifications.dll"));
var htmlFile = "Dynamo.Notifications.node_modules._dynamods.notifications_center.build.index.html";
var htmlFile = "Dynamo.Notifications.Packages.NotificationCenter.build.index.html";

var mainJstag = "mainJs";

Expand Down

0 comments on commit 2cec940

Please sign in to comment.