-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add VitePress lint target (#104)
Co-authored-by: Raphael Strotz <Xzelsius@users.noreply.github.com>
- Loading branch information
Showing
6 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
#nullable enable | ||
Ayaka.Nuke.VitePress.ICanVitePressLint | ||
Ayaka.Nuke.VitePress.ICanVitePressLint.VitePressLintSettings.get -> Nuke.Common.Tooling.Configure<Nuke.Common.Tools.Npm.NpmRunSettings!>! | ||
Ayaka.Nuke.VitePress.ICanVitePressLint.VitePressLintSettingsBase.get -> Nuke.Common.Tooling.Configure<Nuke.Common.Tools.Npm.NpmRunSettings!>! | ||
Ayaka.Nuke.VitePress.IHaveVitePressLintTarget | ||
Ayaka.Nuke.VitePress.IHaveVitePressLintTarget.VitePressLint.get -> Nuke.Common.Target! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright (c) Raphael Strotz. All rights reserved. | ||
|
||
namespace Ayaka.Nuke.VitePress; | ||
|
||
using global::Nuke.Common; | ||
using global::Nuke.Common.Tooling; | ||
using global::Nuke.Common.Tools.Npm; | ||
|
||
/// <summary> | ||
/// Provides a target for linting a VitePress site to the <see cref="INukeLint" />. | ||
/// </summary> | ||
public interface ICanVitePressLint | ||
: ICan, | ||
IHaveDocumentation, | ||
IHaveVitePressInstallTarget, | ||
IHaveVitePressLintTarget | ||
{ | ||
/// <summary> | ||
/// Gets the base settings for linting the VitePress site. | ||
/// </summary> | ||
[ExcludeFromCodeCoverage] | ||
sealed Configure<NpmRunSettings> VitePressLintSettingsBase | ||
=> run => run | ||
.SetProcessWorkingDirectory(DocsDirectory) | ||
.SetCommand("lint") | ||
.SetProcessLogOutput(Verbosity == Verbosity.Verbose); | ||
|
||
/// <summary> | ||
/// Gets the additional settings for linting the VitePress site. | ||
/// </summary> | ||
/// <remarks> | ||
/// Override this to provide additional settings for the <see cref="IHaveVitePressLintTarget.VitePressLint" /> | ||
/// target. | ||
/// </remarks> | ||
[ExcludeFromCodeCoverage] | ||
Configure<NpmRunSettings> VitePressLintSettings | ||
=> run => run; | ||
|
||
/// <inheritdoc /> | ||
[ExcludeFromCodeCoverage] | ||
Target IHaveVitePressLintTarget.VitePressLint => target => target | ||
.Description("Lints the VitePress site") | ||
.Unlisted() | ||
.DependsOn<IHaveVitePressInstallTarget>() | ||
.TryBefore<IHaveVitePressBuildTarget>() | ||
.Executes(() => | ||
{ | ||
_ = NpmTasks.NpmRun( | ||
npm => npm | ||
.Apply(VitePressLintSettingsBase) | ||
.Apply(VitePressLintSettings)); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) Raphael Strotz. All rights reserved. | ||
|
||
namespace Ayaka.Nuke.VitePress; | ||
|
||
using global::Nuke.Common; | ||
|
||
/// <summary> | ||
/// Indicates that a <see cref="INukeBuild" /> has a target for linting a VitePress site. | ||
/// </summary> | ||
public interface IHaveVitePressLintTarget : IHave | ||
{ | ||
/// <summary> | ||
/// Gets the target for linting a VitePress site. | ||
/// </summary> | ||
Target VitePressLint { get; } | ||
} |