This file provides guidance for working with the @expo/eas-json package.
A library for parsing and validating eas.json configuration files. Published as @expo/eas-json on npm.
- Validates
eas.jsonconfiguration files using Joi schemas - Manages build, submit, and deploy profiles
- Supports JSON5 via golden-fleece
- Used by eas-cli and other Expo tools
yarn build # TypeScript compilation (src → build)
yarn watch # Watch mode
yarn typecheck # Type check
yarn test # Run testsThe package uses Joi for schema validation:
Location: src/schema.ts
The schema defines valid structure for:
- Build profiles
- Submit profiles
- Deploy profiles
- CLI version constraints
Uses golden-fleece library to support JSON5 syntax in eas.json:
- Comments
- Trailing commas
- Unquoted keys
- Single quotes
import { EasJsonAccessor, EasJsonUtils } from '@expo/eas-json';
// Read eas.json from project directory
const easJson = await EasJsonUtils.readAsync(projectDir);
// Access build profiles
const buildProfile = easJson.build?.[profileName];
if (!buildProfile) {
throw new Error(`Build profile "${profileName}" not found`);
}
// Access submit profiles
const submitProfile = easJson.submit?.[profileName];
// Check CLI version constraint
const cliVersion = easJson.cli?.version;import { EasJsonAccessor } from '@expo/eas-json';
// Create accessor from project path
const accessor = EasJsonAccessor.fromProjectPath(projectDir);
// Read raw eas.json
const rawJson = await accessor.readRawAsync();
// Read and validate eas.json
const easJson = await accessor.readAsync();
// Write eas.json
await accessor.writeAsync(easJson);import { validateEasJsonAsync } from '@expo/eas-json';
try {
await validateEasJsonAsync(projectDir);
console.log('eas.json is valid');
} catch (error) {
console.error('Validation error:', error.message);
}Build profiles can contain:
distribution: Distribution type (store, internal, simulator)platform: Platform-specific configuration (iOS/Android)env: Environment variablesnode: Node.js versionyarn: Yarn versionnpm: npm versioncache: Cache configuration- And many more build-specific options
Submit profiles contain app store submission configuration:
- iOS: App Store Connect credentials, ASC App ID
- Android: Google Service Account key, track
Deploy profiles for EAS Deploy (worker deployments):
region: Deployment regionnodeVersion: Node.js version- Environment configuration
- JSON5: Full JSON5 syntax support via golden-fleece
- Validation: Joi schema validation with helpful error messages
- Types: Comprehensive TypeScript types exported
- CLI Version: Supports enforcing eas-cli version via
cli.versionfield