Skip to content

Commit

Permalink
Merge pull request #5859 from bdukes/use-yarn-via-corepack
Browse files Browse the repository at this point in the history
Use corepack to run Yarn
  • Loading branch information
valadas authored Nov 6, 2023
2 parents 35c31db + b46318d commit a94acf8
Show file tree
Hide file tree
Showing 69 changed files with 239 additions and 1,012 deletions.
10 changes: 7 additions & 3 deletions .github/BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ There are three supported build scenarios:
When contributing to DNN, you'd typically go through steps 2 and 3 at least and maybe 1 if you wish to run more encompassing tests. But before you delve into code, please familiarize yourself with [How to Contribute](/CONTRIBUTING.md) first.


## Build/Develop Prerequisites

- Visual Studio 2022 (or .NET SDK 6.x) or later
- Node.js 18.x or later
- This project uses [Yarn](https://yarnpkg.com/), enable its local usage by running `corepack enable`

## External sources

There is one project not included in this repository that are distributed with DNN:
Expand Down Expand Up @@ -40,7 +46,7 @@ Note that (unless a build version has been specified, see below) this process wi

This process also uses Cake and follows the same logic as above, with the sole difference that the output is not a distribution zip file but rather this process pumps contents out to a directory you specify. Also you need to tell this process about your SQL server so that it can reset the database. When complete you should get the same experience as if you've built the platform and unpacked it on a server.

### Prerequisites
### Development Site Prerequisites

You'll need to be running IIS and SQL server (Express) locally for this to work. Create a folder on your hard disk and set it up in IIS as a web application. Then create or edit the local settings file.

Expand Down Expand Up @@ -156,8 +162,6 @@ If a build fails midway and you have tracked artifacts, you can simply run:

If you encounter PowerShell security issues, please read [Cake - PowerShell Security](http://cakebuildbotdevelop.azurewebsites.net/docs/tutorials/powershell-security).

If you encouter Yarn issues, please [update Yarn to the lastest version](https://yarnpkg.com/getting-started/install).

### Git branching strategy

Our default branch is called **develop**, this is the branch most pull requests should target in order to be merged into the very next release (bug fixes, minor improvements that are not breaking changes). If you know your change will be a breaking change or more risky, then you should submit it targeting the **future/xx** branch (where xx is the next major release). **release/x.x.x** branches are temporary, they get created at code-freeze to built an alpha release for the testing team, when initial testing is done, we publish one or more release candiate versions (RC1, RC2) as needed until we find the version stable for release, at which point we release that new version and close the release/x.x.x branch. The only pull requests that will be accepted for release/x.x.x branches are for regression issues (the problem was introduced in this very version) or showstopper issues (can't use Dnn with this bug in).
873 changes: 0 additions & 873 deletions .yarn/releases/yarn-3.4.1.cjs

This file was deleted.

2 changes: 0 additions & 2 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.4.1.cjs
1 change: 0 additions & 1 deletion Build/Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
<PackageReference Include="Cake.Issues.MsBuild" Version="3.0.0" />
<PackageReference Include="Cake.Json" Version="7.0.1" />
<PackageReference Include="Cake.XdtTransform" Version="2.0.0" />
<PackageReference Include="Cake.Yarn" Version="2.0.0" />
<PackageReference Include="Dnn.CakeUtils" Version="2.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
Expand Down
6 changes: 6 additions & 0 deletions Build/Lifetime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace DotNetNuke.Build
using Cake.Common;
using Cake.Common.Diagnostics;
using Cake.Core;
using Cake.Core.Diagnostics;
using Cake.Core.IO;
using Cake.Frosting;

Expand All @@ -24,6 +25,11 @@ public override void Setup(Context context, ISetupContext setupContext)
Git(context, "add .");
Git(context, "commit --allow-empty -m 'backup'");
}

if (context.Tools.Resolve(new[] { "corepack", "corepack.cmd", }) is null)
{
throw new CakeException("Could not find corepack, Node.js 18 or later must be installed.");
}
}

/// <inheritdoc/>
Expand Down
2 changes: 1 addition & 1 deletion Build/Symbols/DotNetNuke_Symbols.dnn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="DotNetNuke_Symbols" type="Library" version="09.12.00" >
<package name="DotNetNuke_Symbols" type="Library" version="09.13.00" >
<friendlyName>DNN Platform Symbols</friendlyName>
<description>This package contains Debug Symbols and Intellisense files for DNN Platform.</description>
<owner>
Expand Down
51 changes: 30 additions & 21 deletions Build/Tasks/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace DotNetNuke.Build.Tasks
using Cake.Common.Build.AzurePipelines.Data;
using Cake.Common.IO;
using Cake.Common.Tools.MSBuild;
using Cake.Core;
using Cake.Core.IO;
using Cake.Frosting;
using Cake.Issues;
Expand Down Expand Up @@ -40,28 +41,9 @@ public override void Run(Context context)
}
finally
{
var issueProviders =
from logFilePath in new[] { cleanLog, buildLog, }
where context.FileExists(logFilePath)
let settings = new MsBuildIssuesSettings(logFilePath, context.MsBuildBinaryLogFileFormat())
select new MsBuildIssuesProvider(context.Log, settings);
var issues = context.ReadIssues(issueProviders, context.Directory("."));
foreach (var issue in issues)
if (context.AzurePipelines().IsRunningOnAzurePipelines)
{
var messageData = new AzurePipelinesMessageData
{
SourcePath = issue.AffectedFileRelativePath?.FullPath,
LineNumber = issue.Line,
};

if (string.Equals(issue.PriorityName, "Error", StringComparison.Ordinal))
{
context.AzurePipelines().Commands.WriteError(issue.MessageText, messageData);
}
else
{
context.AzurePipelines().Commands.WriteWarning(issue.MessageText, messageData);
}
ReportIssuesToAzurePipelines(context, cleanLog, buildLog);
}
}
}
Expand All @@ -73,5 +55,32 @@ private static MSBuildSettings CreateMsBuildSettings(Context context, FilePath b
.EnableBinaryLogger(binLogPath.FullPath)
.SetNoConsoleLogger(context.IsRunningInCI);
}

private static void ReportIssuesToAzurePipelines(ICakeContext context, FilePath cleanLog, FilePath buildLog)
{
var issueProviders =
from logFilePath in new[] { cleanLog, buildLog, }
where context.FileExists(logFilePath)
let settings = new MsBuildIssuesSettings(logFilePath, context.MsBuildBinaryLogFileFormat())
select new MsBuildIssuesProvider(context.Log, settings);
var issues = context.ReadIssues(issueProviders, context.Directory("."));
foreach (var issue in issues)
{
var messageData = new AzurePipelinesMessageData
{
SourcePath = issue.AffectedFileRelativePath?.FullPath,
LineNumber = issue.Line,
};

if (string.Equals(issue.PriorityName, "Error", StringComparison.Ordinal))
{
context.AzurePipelines().Commands.WriteError(issue.MessageText, messageData);
}
else
{
context.AzurePipelines().Commands.WriteWarning(issue.MessageText, messageData);
}
}
}
}
}
31 changes: 23 additions & 8 deletions Build/Tasks/BuildNpmPackages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,38 @@
// See the LICENSE file in the project root for more information
namespace DotNetNuke.Build.Tasks
{
using System;

using Cake.Common.IO;
using Cake.Core.Tooling;
using Cake.Common.Tools.Command;
using Cake.Core;
using Cake.Core.IO;
using Cake.Frosting;
using Cake.Yarn;

/// <summary>Builds the npm packages for the entire solution.</summary>
public sealed class BuildNpmPackages : FrostingTask<Context>
{
/// <inheritdoc/>
public override void Run(Context context)
{
context.Yarn().Install(c => c
.WithArgument("--no-immutable")
.WithWorkingDirectory(context.Directory("./")));
context.Yarn().RunScript("build");
var corepackCommand = new CommandSettings
{
ToolName = "Corepack",
ToolExecutableNames = new[] { "corepack", "corepack.cmd", },
WorkingDirectory = context.Directory("./"),
};

context.Command(
corepackCommand,
new ProcessArgumentBuilder()
.Append("yarn")
.Append("install")
.Append("--no-immutable"));

context.Command(
corepackCommand,
new ProcessArgumentBuilder()
.Append("yarn")
.Append("run")
.Append("build"));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="DotNetNuke.Console" type="Module" version="09.12.00">
<package name="DotNetNuke.Console" type="Module" version="09.13.00">
<friendlyName>Console</friendlyName>
<description>Display children pages as icon links for navigation.</description>
<iconFile>~/DesktopModules/Admin/Console/console.png</iconFile>
Expand Down
2 changes: 1 addition & 1 deletion DNN Platform/Connectors/Azure/AzureConnector.dnn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="Dnn.AzureConnector" type="Connector" isSystem="false" version="09.12.00">
<package name="Dnn.AzureConnector" type="Connector" isSystem="false" version="09.13.00">
<friendlyName>Dnn Azure Connector</friendlyName>
<description>The Azure Connector allows you to create folders mapped to Azure Storage accounts.</description>
<iconFile>~/DesktopModules/Connectors/Azure/Images/icon-azure-32px.png</iconFile>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="DNN.Connectors.GoogleAnalytics" type="Connector" isSystem="false" version="09.12.00">
<package name="DNN.Connectors.GoogleAnalytics" type="Connector" isSystem="false" version="09.13.00">
<friendlyName>Google Analytics (Legacy UA) Connector</friendlyName>
<description>Configure your site's Google Analytics settings using Universal Analytics.</description>
<iconFile>~/DesktopModules/Connectors/GoogleAnalytics/Images/GoogleAnalytics_32X32_Standard.png</iconFile>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="DNN.Connectors.GoogleAnalytics4" type="Connector" isSystem="false" version="09.12.00">
<package name="DNN.Connectors.GoogleAnalytics4" type="Connector" isSystem="false" version="09.13.00">
<friendlyName>Google Analytics 4 Connector</friendlyName>
<description>Configure your site's Google Analytics 4 settings.</description>
<iconFile>~/DesktopModules/Connectors/GoogleAnalytics4/Images/GoogleAnalytics4_32X32_Standard.png</iconFile>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="DNN.Connectors.GoogleTagManager" type="Connector" isSystem="false" version="09.12.00">
<package name="DNN.Connectors.GoogleTagManager" type="Connector" isSystem="false" version="09.13.00">
<friendlyName>Google Tag Manager Connector</friendlyName>
<description>Configure your site's Google Tag Manager settings.</description>
<iconFile>~/DesktopModules/Connectors/GoogleTagManager/Images/GoogleTagManager_32X32_Standard.png</iconFile>
Expand Down
2 changes: 1 addition & 1 deletion DNN Platform/Dnn.AuthServices.Jwt/Dnn.Jwt.dnn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="DNNJWT" type="Provider" version="09.12.00">
<package name="DNNJWT" type="Provider" version="09.13.00">
<friendlyName>DNN JWT Auth Handler</friendlyName>
<description>DNN Json Web Token Authentication (JWT) library for cookie-less Mobile authentication clients</description>
<dependencies/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="DotNetNuke.ClientAPI" type="Library" version="09.12.00" >
<package name="DotNetNuke.ClientAPI" type="Library" version="09.13.00" >
<friendlyName>DotNetNuke ClientAPI</friendlyName>
<description>The DotNetNuke Client API is composed of both server-side and client-side code that works together to enable a simple and reliable interface for the developer to provide a rich client-side experience.</description>
<dependencies/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="DnnPlugins" type="JavaScript_Library" version="09.12.00" isSystem="true">
<package name="DnnPlugins" type="JavaScript_Library" version="09.13.00" isSystem="true">
<friendlyName>DNN jQuery Plugins</friendlyName>
<description>A collection of jQuery plugins for DNN UI components (tabs, panels, tooltips, checkboxes, etc.)</description>
<iconFile>Icons\Sigma\Extensions_32x32_Standard.png</iconFile>
Expand Down
2 changes: 1 addition & 1 deletion DNN Platform/Modules/CoreMessaging/CoreMessaging.dnn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="6.0">
<packages>
<package name="DotNetNuke.Modules.CoreMessaging" type="Module" isSystem="true" version="09.12.00">
<package name="DotNetNuke.Modules.CoreMessaging" type="Module" isSystem="true" version="09.13.00">
<friendlyName>Message Center</friendlyName>
<description>Core Messaging module allows users to message each other.</description>
<iconFile>~/DesktopModules/CoreMessaging/Images/messaging_32X32.png</iconFile>
Expand Down
2 changes: 1 addition & 1 deletion DNN Platform/Modules/DDRMenu/DDRMenu.dnn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="DDRMenu" type="Module" isSystem="true" version="09.12.00">
<package name="DDRMenu" type="Module" isSystem="true" version="09.13.00">
<friendlyName>DDR Menu</friendlyName>
<description>DotNetNuke Navigation Provider.</description>
<owner>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="SiteExportImport" type="Library" isSystem="false" version="09.12.00">
<package name="SiteExportImport" type="Library" isSystem="false" version="09.13.00">
<friendlyName>Site Export Import</friendlyName>
<description>DotNetNuke Corporation Site Export Import Library</description>
<iconFile>Images/Files_32x32_Standard.png</iconFile>
Expand Down
2 changes: 1 addition & 1 deletion DNN Platform/Modules/Groups/SocialGroups.dnn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="Social Groups" type="Module" isSystem="true" version="09.12.00">
<package name="Social Groups" type="Module" isSystem="true" version="09.13.00">
<friendlyName>Social Groups</friendlyName>
<description>DotNetNuke Corporation Social Groups module</description>
<iconFile>~/DesktopModules/SocialGroups/Images/Social_Groups_32X32.png</iconFile>
Expand Down
2 changes: 1 addition & 1 deletion DNN Platform/Modules/HTML/dnn_HTML.dnn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="DNN_HTML" type="Module" version="09.12.00">
<package name="DNN_HTML" type="Module" version="09.13.00">
<friendlyName>HTML</friendlyName>
<description>This module renders a block of HTML or Text content. The Html/Text module allows authorized users to edit the content either inline or in a separate administration page. Optional tokens can be used that get replaced dynamically during display. All versions of content are stored in the database including the ability to rollback to an older version.</description>
<iconFile>DesktopModules\HTML\Images\html.png</iconFile>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="6.0">
<packages>
<package name="DotNetNuke.HtmlEditorManager" type="Module" version="09.12.00" >
<package name="DotNetNuke.HtmlEditorManager" type="Module" version="09.13.00" >
<friendlyName>Html Editor Management</friendlyName>
<iconFile>Images/HtmlEditorManager_Standard_32x32.png</iconFile>
<description>A module used to configure toolbar items, behavior, and other options used in the DotNetNuke HtmlEditor Provider.</description>
Expand Down
2 changes: 1 addition & 1 deletion DNN Platform/Modules/Journal/Journal.dnn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="Journal" type="Module" isSystem="true" version="09.12.00">
<package name="Journal" type="Module" isSystem="true" version="09.13.00">
<friendlyName>Journal</friendlyName>
<description>DotNetNuke Corporation Journal module</description>
<iconFile>DesktopModules/Journal/Images/journal_32X32.png</iconFile>
Expand Down
2 changes: 1 addition & 1 deletion DNN Platform/Modules/MemberDirectory/MemberDirectory.dnn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="6.0">
<packages>
<package name="DotNetNuke.Modules.MemberDirectory" type="Module" isSystem="true" version="09.12.00">
<package name="DotNetNuke.Modules.MemberDirectory" type="Module" isSystem="true" version="09.13.00">
<friendlyName>Member Directory</friendlyName>
<description>The Member Directory module displays a list of Members based on role, profile property or relationship.</description>
<iconFile>~/DesktopModules/MemberDirectory/Images/member_list_32X32.png</iconFile>
Expand Down
2 changes: 1 addition & 1 deletion DNN Platform/Modules/RazorHost/Manifest.dnn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="{0}" type="Module" isSystem="true" version="09.12.00">
<package name="{0}" type="Module" isSystem="true" version="09.13.00">
<friendlyName>{0}</friendlyName>
<description>{1}</description>
<owner>
Expand Down
2 changes: 1 addition & 1 deletion DNN Platform/Modules/RazorHost/RazorHost.dnn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="DNNCorp.RazorHost" type="Module" version="09.12.00" >
<package name="DNNCorp.RazorHost" type="Module" version="09.13.00" >
<friendlyName>Razor Host</friendlyName>
<description>The Razor Host module allows developers to host Razor Scripts.</description>
<owner>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dnn-resource-manager",
"version": "9.12.0",
"version": "9.13.0",
"description": "Resource Manager",
"private": true,
"main": "dist/index.cjs.js",
Expand Down
2 changes: 1 addition & 1 deletion DNN Platform/Modules/ResourceManager/ResourceManager.dnn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="6.0">
<packages>
<package name="ResourceManager" type="Module" version="09.12.00">
<package name="ResourceManager" type="Module" version="09.13.00">
<friendlyName>Resource Manager</friendlyName>
<description>This module allows you to manage files on the server</description>
<iconFile>~/Images/icon_filemanager_32px.gif</iconFile>
Expand Down
2 changes: 1 addition & 1 deletion DNN Platform/Modules/TelerikRemoval/TelerikRemoval.dnn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="6.0">
<packages>
<package name="TelerikRemoval" type="Module" version="09.12.00">
<package name="TelerikRemoval" type="Module" version="09.13.00">
<friendlyName>Telerik Removal</friendlyName>
<description>This module allows you to remove the DotNetNuke Telerik Web Components library from your site.</description>
<owner>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="DNN_FacebookAuthentication" type="Auth_System" version="09.12.00" >
<package name="DNN_FacebookAuthentication" type="Auth_System" version="09.13.00" >
<friendlyName>DotNetNuke Facebook Authentication Project</friendlyName>
<description>The DotNetNuke Facebook Authentication Project is an Authentication provider for DotNetNuke that uses
Facebook authentication to authenticate users.
Expand Down
Loading

0 comments on commit a94acf8

Please sign in to comment.