<commit_before>//#!/usr/bin/env node

const cli = require("cli");
const uglify = require("uglify-es");

const readFile = require("../lib/read-file");
const generator = require("../lib/generator");

const classTranspiler = require("../");

const options = cli.parse({
    source: ["s", "Source class file path", "file", false],
    output: ["o", "Output file path", "file", false]
});

if (options.source === false) cli.fatal("Invalid or no source file.");
if (options.output === false) cli.fatal("Invalid or no output file.");

cli.info("Transpiling JS class");

generator(function*(cont) {
    cli.debug("Reading source file...");
    let source = yield readFile(options.source, cli.progress).then(cont());

    let result = classTranspiler.transpile(source);

    cli.debug("Uglifying code...");

    let ugly = uglify.minify(result);
    if (ugly.error) throw ugly.error;

    cli.debug("Saving code...");
    readFile.saveFile(options.output, ugly.code);

    cli.info("Completed. View the transpiled class at " + options.output);
})().catch(err => cli.fatal(err.stack));<commit_msg>Fix Windows Script Host error<commit_after>//#!/usr/bin/env node

var cli = require("cli");
var uglify = require("uglify-es");

var readFile = require("../lib/read-file");
var generator = require("../lib/generator");

var classTranspiler = require("../");

var options = cli.parse({
    source: ["s", "Source class file path", "file", false],
    output: ["o", "Output file path", "file", false]
});

if (options.source === false) cli.fatal("Invalid or no source file.");
if (options.output === false) cli.fatal("Invalid or no output file.");

cli.info("Transpiling JS class");

generator(function*(cont) {
    cli.debug("Reading source file...");
    var source = yield readFile(options.source, cli.progress).then(cont());

    var result = classTranspiler.transpile(source);

    cli.debug("Uglifying code...");

    var ugly = uglify.minify(result);
    if (ugly.error) throw ugly.error;

    cli.debug("Saving code...");
    readFile.saveFile(options.output, ugly.code);

    cli.info("Compvared. View the transpiled class at " + options.output);
})().catch(function(err) {cli.fatal(err.stack)});
{'fraction_non_alphanumeric': 0.18930041152263374, 'fraction_numerical': 0.0, 'mean_word_length': 4.088372093023255, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '1495032', 'n_tokens_mistral': 720, 'n_tokens_neox': 689, 'n_words': 179}