Skip to content

Commit

Permalink
update dependencies (#1211)
Browse files Browse the repository at this point in the history
  • Loading branch information
irahopkinson authored Oct 15, 2024
2 parents f9136ab + 19dd804 commit b47a8f3
Show file tree
Hide file tree
Showing 105 changed files with 4,580 additions and 1,623 deletions.
6 changes: 5 additions & 1 deletion .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
// #region shared with https://github.com/paranext/paranext-multi-extension-template/blob/main/.stylelintrc.js and https://github.com/paranext/paranext-extension-template/blob/main/.stylelintrc.js

module.exports = {
extends: ['stylelint-config-recommended', 'stylelint-config-sass-guidelines'],
extends: [
'stylelint-config-recommended',
'stylelint-config-sass-guidelines',
'stylelint-config-tailwindcss/scss',
],
overrides: [
{
files: ['**/*.scss'],
Expand Down
2 changes: 1 addition & 1 deletion c-sharp/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.23.0",
"version": "0.29.2",
"commands": ["dotnet-csharpier"]
}
}
Expand Down
25 changes: 11 additions & 14 deletions c-sharp/Checks/CheckRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,20 @@ protected override ResponseToRequest HandleRequest(string functionName, JsonArra

return functionName switch
{
"disableCheck"
=> DisableCheck(
args[0].Deserialize<string>() ?? "",
args.Count > 1 ? args[1].Deserialize<string>() : null
),
"enableCheck"
=> EnableCheck(
args[0].Deserialize<string>() ?? "",
args[1].Deserialize<string>() ?? ""
),
"disableCheck" => DisableCheck(
args[0].Deserialize<string>() ?? "",
args.Count > 1 ? args[1].Deserialize<string>() : null
),
"enableCheck" => EnableCheck(
args[0].Deserialize<string>() ?? "",
args[1].Deserialize<string>() ?? ""
),
"getActiveRanges" => GetActiveRanges(),
"getAvailableChecks" => GetAvailableChecks(),
"getCheckResults" => GetCheckResults(),
"setActiveRanges"
=> SetActiveRanges(
CheckInputRangeConverter.CreateCheckInputRangeArray(args[1])
),
"setActiveRanges" => SetActiveRanges(
CheckInputRangeConverter.CreateCheckInputRangeArray(args[1])
),
_ => ResponseToRequest.Failed($"Unknown function: {functionName}"),
};
}
Expand Down
4 changes: 2 additions & 2 deletions c-sharp/JsonUtils/PrivateConstructorResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public override JsonTypeInfo GetTypeInfo(Type type, JsonSerializerOptions option
if (jsonTypeInfo is { Kind: JsonTypeInfoKind.Object, CreateObject: null })
{
if (
jsonTypeInfo.Type
.GetConstructors(BindingFlags.Public | BindingFlags.Instance)
jsonTypeInfo
.Type.GetConstructors(BindingFlags.Public | BindingFlags.Instance)
.All(c => c.GetParameters().Length > 0)
)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Paranext.DataProvider.Messages;
using System.Collections.Concurrent;
using System.Text.Json;
using Paranext.DataProvider.Messages;

namespace Paranext.DataProvider.MessageHandlers;

Expand Down
2 changes: 1 addition & 1 deletion c-sharp/Messages/MessageEventClientConnect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public MessageEventClientConnect(int clientId, bool didReconnect)
new MessageEventClientConnectContents
{
ClientId = clientId,
DidReconnect = didReconnect
DidReconnect = didReconnect,
}
) { }
}
Expand Down
2 changes: 1 addition & 1 deletion c-sharp/Messages/MessageEventObjectCreated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public MessageEventObjectCreated(string id, string objectType, string[] function
{
Id = id,
ObjectType = objectType,
Functions = functions
Functions = functions,
}
) { }
}
Expand Down
2 changes: 1 addition & 1 deletion c-sharp/Messages/MessageEventProjectDataProviderCreated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ List<string> projectInterfaces
{
ProjectId = projectID,
ProjectInterfaces = projectInterfaces,
}
},
}
) { }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ List<string> projectInterfaces
Attributes = new ProjectDataProviderFactoryAttributes
{
ProjectInterfaces = projectInterfaces,
}
},
}
) { }
}
Expand Down
4 changes: 2 additions & 2 deletions c-sharp/Messages/MessageResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ string errorMessage
RequestId = requestId,
RequesterId = requesterId,
Success = false,
ErrorMessage = errorMessage
ErrorMessage = errorMessage,
};
}

Expand All @@ -53,7 +53,7 @@ public static MessageResponse Succeeded(
RequestId = requestId,
RequesterId = requesterId,
Success = true,
Contents = contents
Contents = contents,
};
}

Expand Down
6 changes: 3 additions & 3 deletions c-sharp/NetworkObjects/DataProvider.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Paranext.DataProvider.MessageHandlers;
using Paranext.DataProvider.Messages;
using Paranext.DataProvider.MessageTransports;
using System.Collections.Concurrent;
using System.Text.Json;
using System.Text.Json.Nodes;
using Paranext.DataProvider.MessageHandlers;
using Paranext.DataProvider.Messages;
using Paranext.DataProvider.MessageTransports;

namespace Paranext.DataProvider.NetworkObjects;

Expand Down
7 changes: 4 additions & 3 deletions c-sharp/NetworkObjects/TimeDataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ protected override ResponseToRequest HandleRequest(string functionName, JsonArra
{
return functionName switch
{
"getTime"
=> ResponseToRequest.Succeeded(DateTime.Now.ToISO8601TimeFormatWithUTCString()),
"getTime" => ResponseToRequest.Succeeded(
DateTime.Now.ToISO8601TimeFormatWithUTCString()
),
"setTime" => ResponseToRequest.Failed("Cannot set the time"),
_ => ResponseToRequest.Failed($"Unexpected function: {functionName}")
_ => ResponseToRequest.Failed($"Unexpected function: {functionName}"),
};
}
}
13 changes: 8 additions & 5 deletions c-sharp/ParatextUtils/UsfmBookIndexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ public UsfmBookIndexer(string usfm)

#region Properties

public string Usfm { get { return _usfm;} }
public string Usfm
{
get { return _usfm; }
}

#endregion

Expand Down Expand Up @@ -119,19 +122,19 @@ private Dictionary<int, Dictionary<int, int>> BuildIndexes()
if (_usfm[i] != '\\')
continue;

if (_usfm[i+1] == 'c')
if (_usfm[i + 1] == 'c')
{
var chapterNumber = ExtractNumber(_usfm, i+2);
var chapterNumber = ExtractNumber(_usfm, i + 2);
if (chapterNumber.HasValue && chapterNumber.Value > 1)
{
onChapter = chapterNumber.Value;
retVal.Add(onChapter, []);
retVal[onChapter].Add(0, i);
}
}
else if (_usfm[i+1] == 'v')
else if (_usfm[i + 1] == 'v')
{
var verseNumber = ExtractNumber(_usfm, i+2);
var verseNumber = ExtractNumber(_usfm, i + 2);
if (verseNumber.HasValue)
retVal[onChapter].Add(verseNumber.Value, i);
}
Expand Down
55 changes: 37 additions & 18 deletions c-sharp/Projects/LocalParatextProjects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@ internal class LocalParatextProjects

private readonly List<string> _requiredProjectRootFiles = ["usfm.sty", "Attribution.md"];

private static readonly List<string> s_paratextProjectInterfaces = [
private static readonly List<string> s_paratextProjectInterfaces =
[
ProjectInterfaces.BASE,
ProjectInterfaces.USFM_BOOK,
ProjectInterfaces.USFM_CHAPTER,
ProjectInterfaces.USFM_VERSE,
ProjectInterfaces.USX_BOOK,
ProjectInterfaces.USX_CHAPTER,
ProjectInterfaces.USX_VERSE,
ProjectInterfaces.PLAIN_TEXT_VERSE];
ProjectInterfaces.PLAIN_TEXT_VERSE,
];
public LocalParatextProjects()
{
Expand All @@ -44,7 +46,10 @@ public LocalParatextProjects()
"Paratext 9 Projects"
);
Paratext9ProjectsFolder = Path.Join(Path.GetPathRoot(Environment.CurrentDirectory), "My Paratext 9 Projects");
Paratext9ProjectsFolder = Path.Join(
Path.GetPathRoot(Environment.CurrentDirectory),
"My Paratext 9 Projects"
);
}
#endregion
Expand All @@ -68,15 +73,18 @@ public virtual void Initialize(bool shouldIncludePT9ProjectsOnWindows)
ParatextGlobals.Initialize(ProjectRootFolder);
Console.WriteLine(
$"Projects loaded from {ProjectRootFolder}: {string.Join(",", GetScrTexts().Select(scrText => scrText.Name))}");
$"Projects loaded from {ProjectRootFolder}: {string.Join(",", GetScrTexts().Select(scrText => scrText.Name))}"
);

// Read the projects in any locations other than project root folder
IEnumerable<ProjectDetails> otherProjectDetails =
LoadOtherProjectDetails(shouldIncludePT9ProjectsOnWindows);
IEnumerable<ProjectDetails> otherProjectDetails = LoadOtherProjectDetails(
shouldIncludePT9ProjectsOnWindows
);

if (otherProjectDetails.Any())
Console.WriteLine(
$"Projects found in other locations: {string.Join(",", otherProjectDetails.Select(projectDetails => projectDetails.Name))}");
$"Projects found in other locations: {string.Join(",", otherProjectDetails.Select(projectDetails => projectDetails.Name))}"
);

foreach (ProjectDetails projectDetails in otherProjectDetails)
{
Expand Down Expand Up @@ -121,7 +129,7 @@ public static ScrText GetParatextProject(string projectId)

public static List<string> GetParatextProjectInterfaces()
{
return [..s_paratextProjectInterfaces];
return [.. s_paratextProjectInterfaces];
}

#endregion
Expand Down Expand Up @@ -149,7 +157,8 @@ protected static void CreateDirectory(string dir)

#region Private properties and methods

private static IEnumerable<ScrText> GetScrTexts() {
private static IEnumerable<ScrText> GetScrTexts()
{
return ScrTextCollection.ScrTexts(IncludeProjects.ScriptureOnly);
}

Expand All @@ -160,7 +169,7 @@ private static void AddProjectToScrTextCollection(ProjectDetails projectDetails)
var projectName = new ProjectName
{
ShortName = projectDetails.Name,
ProjectPath = projectPath
ProjectPath = projectPath,
};
ScrTextCollection.Add(new ScrText(projectName, RegistrationInfo.DefaultUser));
}
Expand All @@ -169,19 +178,30 @@ private static void AddProjectToScrTextCollection(ProjectDetails projectDetails)
/// Return projects that are available on disk on the local machine
/// </summary>
/// <returns>Enumeration of (ProjectMetadata, project directory) tuples for all projects</returns>
private IEnumerable<ProjectDetails> LoadOtherProjectDetails(bool shouldIncludePT9ProjectsOnWindows)
private IEnumerable<ProjectDetails> LoadOtherProjectDetails(
bool shouldIncludePT9ProjectsOnWindows
)
{
// Get project info for projects outside the normal project root folder
List<string> nonPT9ProjectRootFolders = [];
if (OperatingSystem.IsWindows() && shouldIncludePT9ProjectsOnWindows && Directory.Exists(Paratext9ProjectsFolder)) nonPT9ProjectRootFolders.Add(Paratext9ProjectsFolder);
if (
OperatingSystem.IsWindows()
&& shouldIncludePT9ProjectsOnWindows
&& Directory.Exists(Paratext9ProjectsFolder)
)
nonPT9ProjectRootFolders.Add(Paratext9ProjectsFolder);

foreach (var rootFolder in nonPT9ProjectRootFolders)
{
foreach (var dir in Directory.EnumerateDirectories(rootFolder))
{
// There are a lot of folders with underscores in the name that we should ignore in
// My Paratext 9 Projects
if (rootFolder == Paratext9ProjectsFolder && Path.GetFileNameWithoutExtension(dir).StartsWith('_')) continue;
if (
rootFolder == Paratext9ProjectsFolder
&& Path.GetFileNameWithoutExtension(dir).StartsWith('_')
)
continue;

ProjectDetails? projectDetails;
string errorMessage;
Expand Down Expand Up @@ -224,7 +244,9 @@ out string errorMessage
// https://github.com/ubsicap/Paratext/blob/aaadecd828a9b02e6f55d18e4c5dda8703ce2429/ParatextData/ScrText.cs#L258
// Removing extension twice because file may be in form name.id.ext to match Paratext
// https://github.com/ubsicap/Paratext/blob/aaadecd828a9b02e6f55d18e4c5dda8703ce2429/ParatextData/ScrTextCollection.cs#L1661
var shortName = Path.GetFileNameWithoutExtension(Path.GetFileNameWithoutExtension(projectHomeDir));
var shortName = Path.GetFileNameWithoutExtension(
Path.GetFileNameWithoutExtension(projectHomeDir)
);

var idNode = settings.SelectSingleNode("/ScriptureText/Guid");
if (idNode == null)
Expand Down Expand Up @@ -267,10 +289,7 @@ private void SetUpSampleProject()
{
File.Copy(
filePath,
filePath.Replace(
"assets/" + projectName,
Path.Join(projectFolder)
)
filePath.Replace("assets/" + projectName, Path.Join(projectFolder))
);
}
}
Expand Down
Loading

0 comments on commit b47a8f3

Please sign in to comment.