"""
Tasks for managing the JS components.

:copyright: Copyright 2013-2017, Dorian Puła
    <dorian.pula@amber-penguin-software.ca>
:license: AGPL v3+
"""

import invoke as inv


@inv.task()
def assets(ctx):
    """
    Build the UI + server JS assets.

    :param ctx: Context of the invoke task.
    """
    ctx.run('npm run build', echo=True, pty=True)


@inv.task()
def dev_server(ctx):
    """
    Run a hot-reloading webpack dev server.

    :param ctx: Context of the invoke task.
    """
    ctx.run('npm run dev-server', echo=True, pty=True)
