#!/usr/bin/env node

import lib from "@minify-html/node";
import fs from "fs";
import JavascriptObfuscator from "javascript-obfuscator";

const cfg = {
    minify_css: true,
    minify_js: true,
    keep_comments: false,
    keep_ssi_comments: false,
};

fs.writeFileSync('autocart.js', JavascriptObfuscator.obfuscate(fs.readFileSync('src/autocart.js').toString()
    .replace('https://local.hvatilo.ru:8055', 'https://hvatilo.ru')
).getObfuscatedCode());
fs.writeFileSync('index.html', lib.minify(fs.readFileSync('src/index.html'), cfg));
fs.writeFileSync('auto_cart.html', lib.minify(fs.readFileSync('src/auto_cart.html'), cfg));
