Exemplo n.º 1
0
def build_js(ctx, force=False):
    """Build all javascript files.
    """
    for fname in JSX_FILENAMES:
        jstools.babel(ctx,
                      '{pkg.source_js}/' + fname,
                      '{pkg.django_static}/{pkg.name}/js/' + fname + '.js',
                      force=force)
Exemplo n.º 2
0
def build_js(ctx, force=False):
    """Build all javascript files.
    """
    for fname in JSX_FILENAMES:
        jstools.babel(
            ctx,
            '{pkg.source_js}/' + fname,
            '{pkg.django_static}/{pkg.name}/js/' + fname + '.js',
            force=force
        )
Exemplo n.º 3
0
def test_babel(ctx):
    files = """
        - package.json: |
            { "version": "1.1.2", "description": "",
              "repository": "", "license": ""}
        - foo.js: |
            [1,2,3].map(x => x*x)
    """
    with create_files(files) as directory:
        ctx = ctx.init(pkg=Package())
        babel(
            ctx,
            'foo.js',
            'foo-compiled.js',
        )
        output = open('foo-compiled.js').read()
        assert 'function (x)' in output
        assert 'return' in output