| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- import { Command } from "@commander-js/extra-typings";
- import chalk from "chalk";
- import { processData } from "./process-data.ts";
- import { dumpFactorioData, dumpFactorioIcon } from "./helpers/command.helper.ts";
- import { extractLocale } from "./helpers/locale.helper.ts";
- import { step } from "../helpers/logger.ts";
- export const DEFAULT_OUTPUT_FOLDER = "./src/assets/data/2.0";
- const program = new Command()
- .name("factorio-dump")
- .option("--skip-dump", "Skip the dumping of icon and factorio data", false)
- .option("--skip-locale", "Skip the dumping of locale datas", false)
- .option("-o, --output <path>", "Path to put the extracted data", DEFAULT_OUTPUT_FOLDER)
- .description("Builds Factorio data assets for the web app from local factorio installation")
- .helpOption("-h, --help", "Display help")
- .addHelpText(
- "after",
- `
- Examples
- $ factorio-dump
- $ factorio-dump --skip-dump
- $ factorio-dump --skip-local
- `
- );
- async function run() {
- program.parse(process.argv);
- const options = program.opts();
- console.log(chalk.bold("\n🚀 Factorio Data Pipeline\n"));
- if (!options.skipDump) {
- await step("Dump factorio data", dumpFactorioData);
- await step("Dump factorio icons", dumpFactorioIcon);
- }
- await processData(options.output);
- //await step("Process factorio data and icons", processData, options.output);
- if (!options.skipLocale) await step("Dump factorio locale", extractLocale, options.output);
- console.log(chalk.green("\n✅ All steps completed successfully!"));
- }
- run().catch((err) => {
- console.error(chalk.red("\n❌ Something went wrong:"), err);
- process.exit(1);
- });
|