Skip to content

Commit

Permalink
Add FrozenLockfile to YarnInstallSettings.
Browse files Browse the repository at this point in the history
  • Loading branch information
ddunkin committed Oct 2, 2018
1 parent 7378c73 commit 4340acc
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
14 changes: 12 additions & 2 deletions src/Cake.Yarn.Tests/YarnInstallTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public void Install_Settings_IgnorePlatformWarnings_Should_Use_Correct_Argument_
var result = _fixture.Run();

result.Args.ShouldBe("install --ignore-platform");
}

}

[Fact]
public void Install_Settings_IgnoreEnginesWarnings_Should_Use_Correct_Argument_Provided_In_YarnInstallSettings()
{
Expand All @@ -62,6 +62,16 @@ public void Install_Settings_IgnoreEnginesWarnings_Should_Use_Correct_Argument_P
result.Args.ShouldBe("install --ignore-engines");
}

[Fact]
public void Install_Settings_FrozenLockfile_Should_Use_Correct_Argument_Provided_In_YarnInstallSettings()
{
_fixture.InstallSettings = s => s.WithFrozenLockfile();

var result = _fixture.Run();

result.Args.ShouldBe("install --frozen-lockfile");
}

[Fact]
public void Several_Install_Settings_Should_Use_Correct_Argument_Provided_In_YarnInstallSettings()
{
Expand Down
25 changes: 23 additions & 2 deletions src/Cake.Yarn/YarnInstallSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,17 @@ protected override void EvaluateCore(ProcessArgumentBuilder args)
if (IgnoreOptional)
{
args.Append("--ignore-optional");
}

}

if (IgnoreEngines)
{
args.Append("--ignore-engines");
}

if (FrozenLockfile)
{
args.Append("--frozen-lockfile");
}
}

/// <summary>
Expand Down Expand Up @@ -90,6 +95,17 @@ public YarnInstallSettings IgnoreEnginesWarnings(bool enabled = true)
return this;
}

/// <summary>
/// Applies the --frozen-lockfile parameter
/// </summary>
/// <param name="enabled"></param>
/// <returns></returns>
public YarnInstallSettings WithFrozenLockfile(bool enabled = true)
{
FrozenLockfile = enabled;
return this;
}

/// <summary>
/// --production
/// </summary>
Expand All @@ -109,5 +125,10 @@ public YarnInstallSettings IgnoreEnginesWarnings(bool enabled = true)
/// --ignore-engines
/// </summary>
public bool IgnoreEngines { get; internal set; }

/// <summary>
/// --frozen-lockfile
/// </summary>
public bool FrozenLockfile { get; internal set; }
}
}

0 comments on commit 4340acc

Please sign in to comment.