import { execa } from "execa";
import path from "path";
import {fileURLToPath} from 'url';

const __dirname = fileURLToPath(new URL('.', import.meta.url));

const shrinko8DirPath = path.resolve(__dirname, "../shrinko8");
const shrinko8Path = path.resolve(shrinko8DirPath, "shrinko8.py");
const pico8DatPath = path.resolve(__dirname, "../../pico8.dat");

export const shrinko8 = async (props: {
	inputFile: string;
	outputFile: string;
	options?: string[];
}) => {
	const {inputFile, outputFile, options = []} = props;
	return await execa("python3", [shrinko8Path, inputFile, outputFile, "--pico8-dat", pico8DatPath, ...options])
}

