zuke.tools.yarn

← Python API reference

@zuke/yarn 1.2.0: @zuke/yarn — typed YarnTasks wrappers for the yarn CLI, for use in Zuke build targets (Yarn Classic v1 and Berry v2+; version-specific options are documented on each method).

Symbols

#

YarnAddSettings

class
class YarnAddSettings(YarnSettings)

Settings for yarn add.

  • packages(*specs: str) -> Self

    Package specs to add (required).

  • dev() -> Self

    Add to devDependencies (--dev).

  • exact() -> Self

    Pin the exact version (--exact).

#

YarnDlxSettings

class
class YarnDlxSettings(YarnSettings)

Settings for yarn dlx (Yarn Berry's one-off package runner).

  • command(name: str) -> Self

    The command to execute (required).

  • package(spec: str) -> Self

    An extra package to make available (--package).

  • exec_args(*args: str | float) -> Self

    Arguments forwarded to the command.

#

YarnInstallSettings

class
class YarnInstallSettings(YarnSettings)

Settings for yarn install.

  • immutable() -> Self

    Fail if the lockfile would change — --immutable (Yarn Berry).

  • frozen_lockfile() -> Self

    Fail if the lockfile would change — --frozen-lockfile (Yarn Classic).

#

YarnRemoveSettings

class
class YarnRemoveSettings(YarnSettings)

Settings for yarn remove.

  • packages(*names: str) -> Self

    Package names to remove (required).

#

YarnRunSettings

class
class YarnRunSettings(YarnSettings)

Settings for yarn run.

  • script(name: str) -> Self

    The package.json script to run (required).

  • script_args(*args: str | float) -> Self

    Arguments forwarded to the script.

#

YarnSettings

class
class YarnSettings(ToolSettings)

Base for all yarn subcommand settings: binary is yarn from PATH.

#

YarnTasks

class
class YarnTasks

Typed task functions for the yarn CLI.

  • static async install(ctx: ServiceContext, configure: Callable[[YarnInstallSettings], YarnInstallSettings] | None=None) -> ExecResult

    Install dependencies: yarn install.

  • static async add(ctx: ServiceContext, configure: Callable[[YarnAddSettings], YarnAddSettings] | None=None) -> ExecResult

    Add dependencies: yarn add.

  • static async remove(ctx: ServiceContext, configure: Callable[[YarnRemoveSettings], YarnRemoveSettings] | None=None) -> ExecResult

    Remove dependencies: yarn remove.

  • static async run(ctx: ServiceContext, configure: Callable[[YarnRunSettings], YarnRunSettings] | None=None) -> ExecResult

    Run a package.json script: yarn run.

  • static async dlx(ctx: ServiceContext, configure: Callable[[YarnDlxSettings], YarnDlxSettings] | None=None) -> ExecResult

    Download and execute a package binary: yarn dlx (Berry).