(local=False, verbose=False)
return config, local_js_dirs
Write build.js file to feed to r.js, run r.js, and return filenames of the final build config
    and the bundle config output by the build.
Write build.js file to feed to r.js, run r.js, and return filenames of the final build config
    and the bundle config output by the build.
Write build . js file to feed to r . js run r . js and return filenames of the final build config and the bundle config output by the build .
def _r_js(local=False, verbose=False):
    '''
    Write build.js file to feed to r.js, run r.js, and return filenames of the final build config
    and the bundle config output by the build.
    '''
    with open(os.path.join(ROOT_DIR, 'staticfiles', 'hqwebapp', 'yaml', 'requirejs.yaml'), 'r') as f:
        config = yaml.safe_load(f)

    config['logLevel'] = 0 if verbose else 2  # TRACE or WARN
    if not verbose:
        print("Compiling Javascript bundles")

    html_files, local_js_dirs = _get_html_files_and_local_js_dirs(local)

    # For each directory, add an optimized "module" entry including all of the main modules in that dir.
    # For each of these entries, r.js will create an optimized bundle of these main modules and all their
    # dependencies
    dirs_to_js_modules = _get_main_js_modules_by_dir(html_files)
    for directory, mains in dirs_to_js_modules.items():
        config['modules'].append({
            'name': os.path.join(directory, "bundle"),
            'exclude': ['hqwebapp/js/common', 'hqwebapp/js/base_main'],
            'include': sorted(mains),
            'create': True,
        })

    _save_r_js_config(config)

    ret = call(["node", "node_modules/requirejs/bin/r.js", "-o", BUILD_JS_FILENAME])
    if ret:
        raise CommandError("Failed to build JS bundles")

    return config, local_js_dirs
def _r_js ( local = False , verbose = False ) : with open ( os . path . join ( ROOT_DIR , 'staticfiles' , 'hqwebapp' , 'yaml' , 'requirejs.yaml' ) , 'r' ) as f : config = yaml . safe_load ( f ) config [ 'logLevel' ] = 0 if verbose else 2 # TRACE or WARN if not verbose : print ( "Compiling Javascript bundles" ) html_files , local_js_dirs = _get_html_files_and_local_js_dirs ( local ) # For each directory, add an optimized "module" entry including all of the main modules in that dir. # For each of these entries, r.js will create an optimized bundle of these main modules and all their # dependencies dirs_to_js_modules = _get_main_js_modules_by_dir ( html_files ) for directory , mains in dirs_to_js_modules . items ( ) : config [ 'modules' ] . append ( { 'name' : os . path . join ( directory , "bundle" ) , 'exclude' : [ 'hqwebapp/js/common' , 'hqwebapp/js/base_main' ] , 'include' : sorted ( mains ) , 'create' : True , } ) _save_r_js_config ( config ) ret = call ( [ "node" , "node_modules/requirejs/bin/r.js" , "-o" , BUILD_JS_FILENAME ] ) if ret : raise CommandError ( "Failed to build JS bundles" ) return config , local_js_dirs