npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

godot-export-presets

v0.1.9

Published

Read and write Godot export_presets.cfg files

Readme

godot-export-presets

Read and write Godot export_presets.cfg files.

This library provides a simple way to programmatically manage Godot export presets. It handles parsing the config file format, merging presets, and includes base presets for common platforms.

The parsing and serialization logic is based on Godot's source code, specifically the ConfigFile, VariantParser, and VariantWriter implementations from the Godot engine repository. This attempts to ensure compatibility with Godot's native export preset format.

Installation

npm install godot-export-presets

Requires Node.js 18 or higher.

Quick Start

import { loadExportPresets, findPreset, saveExportPresets } from 'godot-export-presets';

// Load existing presets
const presets = await loadExportPresets('./export_presets.cfg');

// Find preset by platform name
const androidPreset = findPreset(presets, { platform: 'Android' });
if (androidPreset) {
  androidPreset.export_path = 'game.apk';
}

// Save
await saveExportPresets('./export_presets.cfg', presets);

Examples

Basic Reading and Writing

Load a file, find a preset by name, make changes, and save:

import { loadExportPresets, findPreset, saveExportPresets } from 'godot-export-presets';

const presets = await loadExportPresets('./export_presets.cfg');
console.log(`Found ${presets.presets.length} presets`);

// Find preset by platform (case-insensitive)
const androidPreset = findPreset(presets, { platform: 'android' });
if (androidPreset) {
  androidPreset.export_path = 'game.apk';
}

// Or find by preset name
const iosPreset = findPreset(presets, { name: 'iOS' });
if (iosPreset) {
  iosPreset.export_path = 'game.ipa';
}

await saveExportPresets('./export_presets.cfg', presets);

Using Base Presets

The library includes base presets for Android and iOS on Godot 3.x and 4.x:

import { getBasePreset, getMajorVersion } from 'godot-export-presets';

// Get base preset for Android (Godot 4.x)
const baseAndroid = getBasePreset('Android', 4);

// Extract version from string
const version = getMajorVersion('4.3.2'); // returns 4
const baseForVersion = getBasePreset('iOS', version);

API Overview

Main functions:

  • loadExportPresets(filePath) - Load presets from file
  • saveExportPresets(filePath, presets) - Save presets to file
  • parseExportPresets(content) - Parse from string
  • serializeExportPresets(presets) - Serialize to string
  • findPreset(presets, criteria) - Find preset by platform/name/index
  • getPreset(presets, index) - Get preset by index
  • setPreset(presets, preset, index?) - Add or update preset
  • removePreset(presets, index) - Remove preset
  • mergePresets(...presets) - Merge multiple presets
  • getBasePreset(platform, version) - Get base preset
  • getMajorVersion(version) - Extract major version from string

For full TypeScript types and API details, see the type definitions in dist/index.d.ts.

Implementation Notes

This library is based on Godot's source code. The parsing logic follows Godot's VariantParser implementation, and the serialization follows VariantWriter and String::property_name_encode. The base presets are extracted from real Godot export configurations.

This implementation was created with tool assistance using Cursor and Claude, porting Godot's C++ logic to TypeScript while maintaining compatibility with the original format.

Key Godot source files referenced:

  • core/io/config_file.cpp - ConfigFile parsing and writing
  • core/variant/variant_parser.cpp - Variant parsing logic
  • core/string/ustring.cpp - String encoding for keys
  • editor/export/editor_export.cpp - Export preset structure

License

MIT