Skip to content

Commit

Permalink
what is this junk?
Browse files Browse the repository at this point in the history
  • Loading branch information
capnmidnight committed Apr 4, 2024
1 parent f1f26e7 commit a5d1608
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
2 changes: 2 additions & 0 deletions src/Juniper.TSBuild.Core/BuildSystemOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ public interface IBuildConfig

public class BuildSystemOptions
{
public required DirectoryInfo WorkingDir;

/// <summary>
/// USE WITH CAUTION!
/// A list of directories that will have their contents
Expand Down
22 changes: 9 additions & 13 deletions src/Juniper.TSBuild/BuildSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ static void WriteWarning(string format, params object[] values) =>
private readonly List<CopyCommand> copyCommands = new();

private readonly bool skipPreBuild;
private readonly bool isInProjectProcess;
private readonly bool hasNPM;

private readonly TaskCompletionSource starting = new();
Expand All @@ -49,15 +48,12 @@ private static DirectoryInfo TestDir(string message, DirectoryInfo? dir)
return dir;
}

public BuildSystem(DirectoryInfo? startDir = null)
public BuildSystem()
{
isInProjectProcess = startDir is null;
startDir ??= new DirectoryInfo(Environment.CurrentDirectory);

workingDir = TestDir($"Couldn't find project root from {startDir.FullName}", startDir);

var options = new BuildConfigT().Options;

workingDir = TestDir($"Couldn't find project root from {options.WorkingDir.FullName}", options.WorkingDir);

var inProjectDir = TestDir("You must specify at least one of InProject or OutProject in your BuildConfig.", options.Project ?? options.InProject ?? options.OutProject);

var outProjectDir = TestDir("You must specify at least one of InProject or OutProject in your BuildConfig.", options.Project ?? options.OutProject ?? options.InProject);
Expand All @@ -80,8 +76,8 @@ public BuildSystem(DirectoryInfo? startDir = null)
if (hasNPM)
{
var dirs = new List<DirectoryInfo>{
inProjectDir
};
inProjectDir
};

if (options.AdditionalNPMProjects is not null)
{
Expand Down Expand Up @@ -130,14 +126,14 @@ private async Task CheckNPMProjectAsync(DirectoryInfo project)

if (package.scripts is not null)
{
if (isInProjectProcess && package.scripts.ContainsKey("juniper-build")
|| !isInProjectProcess && !isWorkSpaceSubProject && package.scripts.ContainsKey("build"))
if (isWorkSpaceSubProject && package.scripts.ContainsKey("juniper-build")
|| !isWorkSpaceSubProject && package.scripts.ContainsKey("build"))
{
BuildProjects.Add(pkgFile);
}

if (isInProjectProcess && package.scripts.ContainsKey("juniper-watch")
|| !isInProjectProcess && !isWorkSpaceSubProject && package.scripts.ContainsKey("watch"))
if (isWorkSpaceSubProject && package.scripts.ContainsKey("juniper-watch")
|| !isWorkSpaceSubProject && package.scripts.ContainsKey("watch"))
{
WatchProjects.Add(pkgFile);
}
Expand Down

0 comments on commit a5d1608

Please sign in to comment.