Contributing
Building
Section titled “Building”The project compiles TypeScript to JavaScript with tsc:
npm run buildOutput goes to the build/ directory.
There are two test layers: unit tests (Jest) and integration tests (shell scripts + Node scripts).
Unit tests
Section titled “Unit tests”npm run test:unitUnit tests live next to the source files as *.spec.ts files. They cover:
readConfig.spec.ts— module exclusion logic based on flag state and branch matchinggenerateOverrides.spec.ts— flag enabling/disabling with branch pattern matching (exact, wildcard suffix, prefix, includes)resolveFlagsToInvert.spec.ts— bundle ID matching for flag inversionmain.spec.ts— CLI argument parsingwithFlaggedAutolinking.spec.ts— Podfile andsettings.gradletransformations (uses Jest snapshots)
Unit tests mock fs/promises and readConfig so they run without touching the filesystem.
Integration tests
Section titled “Integration tests”npm testThis runs unit tests first, then the integration suite. The integration tests use the example/ Expo app and exercise end-to-end workflows:
- test-overrides.sh — runs
build-flags overridewith various flag combinations and checks the generated output - test-babel-plugin.js — enables a flag, bundles with the Babel plugin, and asserts that flagged code is included or stripped
- test-config-plugin.js — runs
expo prebuildwithEXPO_BUILD_FLAGSand checksInfo.plistand the generated module - test-config-plugin-android.js — same as above but verifies
AndroidManifest.xml - test-autolinking.js — runs prebuild with
flaggedAutolinking: trueand checks that Podfile.lock and Gradle exclude the right modules
To run integration tests against Expo SDK 52:
npm run test:nextGoals for the library
Section titled “Goals for the library”The library aims to be a minimal, focused toolkit for build-time feature flags in Expo projects. It is not a runtime feature flag service. The core design principles:
- Flags are booleans resolved at build time. Runtime evaluation, remote config, and user targeting are out of scope.
- The generated module is the source of truth for JS. All JS code reads from one
BuildFlagsimport. - Native metadata is informational. The config plugin writes flag names to
Info.plistandAndroidManifest.xmlso you can inspect a binary, but native API convenience wrappers are a future goal. - The toolkit is composable. The CLI, Babel plugin, config plugin, and autolinking integration are all optional. Use only what you need.
- No runtime dependencies. The generated module is plain TypeScript with no imports.
yamland@babel/helper-plugin-utilsare the only production dependencies of the library itself.
Making changes
Section titled “Making changes”- Fork the repository and create a branch.
- Make your changes in
src/. - Run
npm run buildto compile. - Run
npm testto ensure all tests pass. - Open a pull request.