YarnRunnerAliases.

Yarn(ICakeContext) Method

Summary

Get an Yarn runner
Assembly
Cake.Yarn.dll
Namespace
Cake.Yarn
Containing Type
YarnRunnerAliases

Syntax

public static YarnRunner Yarn(this ICakeContext context)

Examples

Run 'yarn install'

Cake task:

Task("Yarn-FromPath")
    .Does(() =>
{
    Yarn.FromPath("./dir-with-packagejson").Install();
});

Run 'yarn install'

Cake task:

Task("Yarn-Install")
    .Does(() =>
{
    Yarn.Install();
});

Run 'yarn pack'

Cake task:

Task("Yarn-Pack")
    .Does(() =>
{
    Yarn.Pack();
});

Run 'yarn add gulp'

Cake task:

Task("Yarn-Add-Gulp")
    .Does(() =>
{
    Yarn.Add(settings => settings.Package("gulp"));
});

Run 'yarn global add gulp'

Cake task:

Task("Yarn-Add-Gulp")
    .Does(() =>
{
    Yarn.Add(settings => settings.Package("gulp").Globally());
});

Run 'yarn run hello'

Cake task:

Task("Yarn-Run")
    .Does(() =>
{
    Yarn.RunScript("hello");
});

Run 'yarn version'

Cake task:

Task("Yarn-Version")
    .Does(() =>
{
    Yarn.Version();
});

Attributes

Type Description
CakePropertyAliasAttribute

Parameters

Name Type Description
context ICakeContext The context

Return Value

Type Description
YarnRunner