<commit_before>import { IConversionJob } from '../job';
import { IStepDescription } from './step';

export function describe(): IStepDescription {
    return {
        code: 'exec-assetbundlecompiler',
        name: 'Execute AssetBundleCompiler to assemble the asset bundle',
        priority: 30,
    };
}

export function shouldProcess(job: IConversionJob) {
    return true;
}

export function process(job: IConversionJob): Promise<void> {
    return Promise.resolve();
}<commit_msg>feat(exec_assetbundlecompiler): implement the creation of the AssetBundle.<commit_after>import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import * as pify from 'pify';
import { BuildTargets, bundle} from '@mitm/assetbundlecompiler';
import { IConversionJob } from '../job';
import { IStepDescription, IStepsContext } from './step';

const { WebGL } = BuildTargets;

export interface IAssetBundleStepsContext extends IStepsContext {
    assetBundleDir: string;
}

export function describe(): IStepDescription {
    return {
        code: 'exec-assetbundlecompiler',
        name: 'Execute AssetBundleCompiler to assemble the asset bundle',
        priority: 30,
    };
}

export function shouldProcess(job: IConversionJob) {
    return true;
}

export async function process(job: IConversionJob, context: IAssetBundleStepsContext ): Promise<void> {
    const tmpDir = path.resolve(`${os.tmpdir()}/chuck-exec-assetbundlecompiler-${Date.now()}`);
    await pify(fs.mkdir)(tmpDir);
    context.assetBundleDir = tmpDir;

    await bundle(...context.assetsPaths)
        .targeting(WebGL)
        .withLogger(async (log) => await job.progress({ type: 'exec-assetbundlecompiler', message: log }) )
        .to(path.resolve(tmpDir, job.data.assetBundleName));
}
{'fraction_non_alphanumeric': 0.12083568605307736, 'fraction_numerical': 0.002258610954263128, 'mean_word_length': 4.166180758017493, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7481325', 'n_tokens_mistral': 519, 'n_tokens_neox': 509, 'n_words': 139}