forked from dnnsoftware/Dnn.Platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetPackageVersions.cs
More file actions
47 lines (43 loc) · 2.1 KB
/
Copy pathSetPackageVersions.cs
File metadata and controls
47 lines (43 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
namespace DotNetNuke.Build.Tasks
{
using System;
using System.Linq;
using Cake.Common.Diagnostics;
using Cake.Common.IO;
using Cake.FileHelpers;
using Cake.Frosting;
/// <summary>A cake task to set the version of client-side packages.</summary>
[IsDependentOn(typeof(SetVersion))]
public sealed class SetPackageVersions : FrostingTask<Context>
{
/// <inheritdoc />
public override void Run(Context context)
{
if (context.Settings.Version == "off")
{
return;
}
var packages = context.GetFiles("./Dnn.AdminExperience/ClientSide/*.Web/package.json");
packages.Add(context.GetFiles("./Dnn.AdminExperience/ClientSide/Dnn.React.Common/package.json"));
packages.Add(context.GetFiles("./Dnn.AdminExperience/ClientSide/*.Web/**/_exportables/package.json"));
packages.Add(context.GetFiles("./DNN Platform/Modules/ResourceManager/ResourceManager.Web/package.json"));
packages.Add(context.GetFiles("./DNN Platform/Skins/Aperture/package.json"));
// Set all package.json in Admin Experience to the current version and to consume the current (local) version of dnn-react-common.
foreach (var file in packages)
{
context.Information($"Updating {file} to version {context.Version.MajorMinorPatch}");
context.ReplaceRegexInFiles(
file.ToString(),
@"""version"": "".*""",
$@"""version"": ""{context.Version.MajorMinorPatch}""");
context.ReplaceRegexInFiles(
file.ToString(),
@"""@dnnsoftware\/dnn-react-common"": "".*""",
$@"""@dnnsoftware/dnn-react-common"": ""{context.Version.MajorMinorPatch}""");
}
}
}
}