diff --git a/package.json b/package.json index 8fd0d3e..6921607 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "elm-optimize-level-2", "description": "A second level of optimization for the Javascript that the Elm Compiler produces.", - "version": "0.2.1", + "version": "0.2.2", "license": "BSD-3-Clause", "main": "dist/index.js", "typings": "dist/index.d.ts", @@ -58,10 +58,10 @@ "ts-node": "^8.10.2", "tslib": "^2.0.0", "uglify-js": "^3.10.0", - "v8-natives": "^1.2.5" + "v8-natives": "^1.2.5", + "@types/selenium-webdriver": "^4.0.14" }, "dependencies": { - "@types/selenium-webdriver": "^4.0.14", "chalk": "^4.1.0", "commander": "^6.0.0", "node-elm-compiler": "^5.0.4", diff --git a/src/index.ts b/src/index.ts index 1f8a02c..7b3b912 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,15 +2,14 @@ import program from 'commander'; import * as path from 'path'; import * as Transform from './transform'; -import { toolDefaults, benchmarkDefaults, Browser} from './types'; +import { toolDefaults } from './types'; import { compileToStringSync } from 'node-elm-compiler'; import * as fs from 'fs'; import chalk from 'chalk'; const { version } = require('../package.json'); -import * as BenchInit from './benchmark/init' -import * as Benchmark from './benchmark/benchmark'; -import * as Reporting from './benchmark/reporting'; -import { readFilesSync } from './fs_util'; +// import * as BenchInit from './benchmark/init' +// import * as Benchmark from './benchmark/benchmark'; +// import * as Reporting from './benchmark/reporting'; program .version(version) @@ -28,9 +27,9 @@ Give me an Elm file, I'll compile it behind the scenes using Elm 0.19.1, and the .usage('[options] ') .option('--output ', 'the javascript file to create.', 'elm.js') .option('-O3, --optimize-speed', 'Enable optimizations that likely increases asset size', false) - .option('--init-benchmark ', 'Generate some files to help run benchmarks') - .option('--benchmark ', 'Run the benchmark in the given directory.') - .option('--replacements ', 'Replace stuff') + // .option('--init-benchmark ', 'Generate some files to help run benchmarks') + // .option('--benchmark ', 'Run the benchmark in the given directory.') + // .option('--replacements ', 'Replace stuff') .parse(process.argv); async function run(inputFilePath: string | undefined) { @@ -39,41 +38,41 @@ async function run(inputFilePath: string | undefined) { let elmFilePath = undefined; const options = program.opts(); - const replacements = options.replacements; + const replacements = null; const o3Enabled = options.optimizeSpeed; - if (program.initBenchmark) { - console.log(`Initializing benchmark ${program.initBenchmark}`) - BenchInit.generate(program.initBenchmark) - process.exit(0) - } + // if (program.initBenchmark) { + // console.log(`Initializing benchmark ${program.initBenchmark}`) + // BenchInit.generate(program.initBenchmark) + // process.exit(0) + // } - if (program.benchmark) { - const options = { - compile: true, - gzip: true, - minify: true, - verbose: true, - assetSizes: true, - runBenchmark: [ - { - browser: Browser.Chrome, - headless: true, - } - ], - transforms: benchmarkDefaults(o3Enabled, replacements), - }; - const report = await Benchmark.run(options, [ - { - name: 'Benchmark', - dir: program.benchmark, - elmFile: 'V8/Benchmark.elm', - } - ]); - console.log(Reporting.terminal(report)); -// fs.writeFileSync('./results.markdown', Reporting.markdownTable(result)); - process.exit(0) - } +// if (program.benchmark) { +// const options = { +// compile: true, +// gzip: true, +// minify: true, +// verbose: true, +// assetSizes: true, +// runBenchmark: [ +// { +// browser: Browser.Chrome, +// headless: true, +// } +// ], +// transforms: benchmarkDefaults(o3Enabled, replacements), +// }; +// const report = await Benchmark.run(options, [ +// { +// name: 'Benchmark', +// dir: program.benchmark, +// elmFile: 'V8/Benchmark.elm', +// } +// ]); +// console.log(Reporting.terminal(report)); +// // fs.writeFileSync('./results.markdown', Reporting.markdownTable(result)); +// process.exit(0) +// } if (inputFilePath && inputFilePath.endsWith('.js')) { jsSource = fs.readFileSync(inputFilePath, 'utf8');