### Dedicated Config File (disk-cache.json) Example Source: https://context7.com/wookiefpv/expo-build-disk-cache/llms.txt Shows an example of a `disk-cache.json` file located in the project root or home directory for machine-specific cache settings. This file can be ignored by Git for per-developer customization. ```json // disk-cache.json (in project root or home directory) { "cacheDir": "/Users/developer/.expo-build-cache", "cacheGcTimeDays": 30, "debug": true } ``` ```json // ~/.config/expo-build-disk-cache/disk-cache.json (global config) { "cacheDir": "~/.expo-build-cache", "enable": true, "debug": false } ``` -------------------------------- ### Install expo-build-disk-cache using npm Source: https://github.com/wookiefpv/expo-build-disk-cache/blob/main/README.md This command installs the expo-build-disk-cache package as a development dependency in your project. It is the first step to enable local disk caching for your Expo builds. ```bash npm install --save-dev expo-build-disk-cache ``` -------------------------------- ### TypeScript Types for Configuration Source: https://context7.com/wookiefpv/expo-build-disk-cache/llms.txt This snippet showcases the usage of TypeScript types exported by the expo-build-disk-cache package. It demonstrates how to define configuration objects and provider interfaces for type-safe setup in `app.config.ts`. ```typescript import type { DiskCacheConfig, DiskCacheProvider } from "expo-build-disk-cache"; import { buildDiskCacheProvider } from "expo-build-disk-cache"; // DiskCacheConfig type definition const config: DiskCacheConfig = { cacheDir: "node_modules/.expo-build-disk-cache", enable: true, debug: false, cacheGcTimeDays: 7, remotePlugin: "eas", remoteOptions: {}, }; // DiskCacheProvider type for app config const provider: DiskCacheProvider = { plugin: "expo-build-disk-cache", options: config, }; // Or use the helper function const typeSafeProvider = buildDiskCacheProvider(config); ``` -------------------------------- ### Configure Expo Build Disk Cache in disk-cache.json Source: https://github.com/wookiefpv/expo-build-disk-cache/blob/main/Configuration.md Shows how to configure 'expo-build-disk-cache' using a dedicated 'disk-cache.json' file. This approach is useful for per-machine customization and can be ignored by version control. ```json { "cacheDir": "node_modules/.expo-build-disk-cache" } ``` -------------------------------- ### Configure Expo Build Disk Cache in app.json Source: https://github.com/wookiefpv/expo-build-disk-cache/blob/main/Configuration.md Demonstrates how to configure the 'expo-build-disk-cache' plugin within the Expo application configuration file ('app.json'). This method allows for project-specific cache settings. ```json { "experiments": { "buildCacheProvider": { "plugin": "expo-build-disk-cache", "options": { "cacheDir": "node_modules/.expo-build-disk-cache" } } } } ``` ```json { "buildCacheProvider": { "plugin": "expo-build-disk-cache", "options": { "cacheDir": "node_modules/.expo-build-disk-cache" } } } ``` -------------------------------- ### Configure Expo Build Disk Cache in package.json Source: https://github.com/wookiefpv/expo-build-disk-cache/blob/main/Configuration.md Illustrates configuring 'expo-build-disk-cache' by adding a 'disk-cache' key to the 'package.json' file. This method integrates cache settings directly into the project's package manifest. ```json { "disk-cache": { "cacheDir": "node_modules/.expo-build-disk-cache" } } ``` -------------------------------- ### Enable EAS Remote Build Cache Provider Source: https://github.com/wookiefpv/expo-build-disk-cache/blob/main/Configuration.md Demonstrates how to enable the EAS remote build cache provider for 'expo-build-disk-cache'. This configuration is done within the 'app.json' file and specifies 'eas' as the remote plugin. ```json { "buildCacheProvider": { "plugin": "expo-build-disk-cache", "options": { "remotePlugin": "eas" } } } ``` -------------------------------- ### Full Configuration Options in app.json Source: https://context7.com/wookiefpv/expo-build-disk-cache/llms.txt Demonstrates how to specify all available configuration options for the disk cache provider within the app.json file. This includes cache directory, garbage collection time, debug mode, enablement, and remote caching integration. ```jsonc // app.json with all configuration options { "buildCacheProvider": { "plugin": "expo-build-disk-cache", "options": { "cacheDir": "node_modules/.expo-build-disk-cache", "cacheGcTimeDays": 7, "debug": false, "enable": true, "remotePlugin": "eas", "remoteOptions": {} } } } ``` -------------------------------- ### Programmatic API: Resolving and Uploading Builds Source: https://context7.com/wookiefpv/expo-build-disk-cache/llms.txt Demonstrates the programmatic usage of the `DiskBuildCacheProvider` API for resolving (checking for) and uploading (saving) cached builds. This involves using `resolveBuildCache` and `uploadBuildCache` methods with specific props and options. ```typescript import DiskBuildCacheProvider from "expo-build-disk-cache"; import type { ResolveBuildCacheProps, UploadBuildCacheProps } from "@expo/config"; // Resolve (check for) a cached build const resolveProps: ResolveBuildCacheProps = { platform: "android", projectRoot: process.cwd(), fingerprintHash: "abc123def456", runOptions: { variant: "debug" }, }; const cachedPath = await DiskBuildCacheProvider.resolveBuildCache( resolveProps, { cacheDir: "node_modules/.expo-build-disk-cache" } ); // Returns: "/path/to/cache/fingerprint.abc123def456.apk" or null // Upload (save) a build to cache const uploadProps: UploadBuildCacheProps = { ...resolveProps, buildPath: "/path/to/android/app/build/outputs/apk/debug/app-debug.apk", }; const savedPath = await DiskBuildCacheProvider.uploadBuildCache( uploadProps, { cacheDir: "node_modules/.expo-build-disk-cache" } ); // Returns: "/path/to/cache/fingerprint.abc123def456.apk" ``` -------------------------------- ### Configure Build Cache Provider with buildDiskCacheProvider Helper (TypeScript) Source: https://context7.com/wookiefpv/expo-build-disk-cache/llms.txt Uses the type-safe `buildDiskCacheProvider` helper function in `app.config.ts` for enhanced TypeScript support and IntelliSense. This allows for programmatic configuration of cache directory, garbage collection time, and debug mode. ```typescript // app.config.ts import { buildDiskCacheProvider } from "expo-build-disk-cache"; import type { ExpoConfig } from "expo/config"; const config: ExpoConfig = { name: "MyApp", slug: "my-app", buildCacheProvider: buildDiskCacheProvider({ cacheDir: "node_modules/.expo-build-disk-cache", cacheGcTimeDays: 14, debug: true, }), }; export default config; ``` -------------------------------- ### Configure Build Cache Provider in app.json (Expo SDK 53) Source: https://context7.com/wookiefpv/expo-build-disk-cache/llms.txt Configures the plugin as the build cache provider using the 'experiments' block in app.json for Expo SDK 53. This is the method for enabling the cache provider in older SDK versions. ```jsonc // app.json (Expo SDK 53 - under experiments) { "expo": { "name": "MyApp", "experiments": { "buildCacheProvider": { "plugin": "expo-build-disk-cache" } } } } ``` -------------------------------- ### Environment Variable Configuration for Disk Cache Source: https://context7.com/wookiefpv/expo-build-disk-cache/llms.txt Configures the disk cache plugin using environment variables, which take precedence over file-based configurations. This method is useful for CI/CD environments and allows overriding settings like cache directory, garbage collection, debug mode, and remote plugin options. ```bash # Environment variable configuration (takes precedence) export DISK_CACHE_CACHE_DIR="$HOME/.expo-build-cache" export DISK_CACHE_GC_TIME_DAYS=14 export DISK_CACHE_DEBUG=true export DISK_CACHE_ENABLE=true export DISK_CACHE_REMOTE_PLUGIN=eas export DISK_CACHE_REMOTE_OPTIONS='{"key": "value"}' npx expo run:android ``` -------------------------------- ### Configure Expo Build Disk Cache for SDK 53 (Experiments) Source: https://github.com/wookiefpv/expo-build-disk-cache/blob/main/README.md This JSON configuration snippet enables the expo-build-disk-cache plugin for Expo SDK 53, utilizing the 'experiments' block. Add this to your app's configuration file (e.g., app.json or app.config.js) to activate the build caching for this SDK version. ```json { "experiments": { "buildCacheProvider": { "plugin": "expo-build-disk-cache" } } } ``` -------------------------------- ### CI/CD Cache Integration with GitHub Actions Source: https://context7.com/wookiefpv/expo-build-disk-cache/llms.txt This snippet illustrates how to integrate the expo-build-disk-cache plugin into a GitHub Actions workflow. It configures the cache to be restored based on the OS and package lock file, ensuring faster subsequent builds. ```yaml # .github/workflows/build.yml name: Build App on: push jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 18 - name: Install dependencies run: npm ci - name: Restore build cache uses: actions/cache@v4 with: path: node_modules/.expo-build-disk-cache key: expo-build-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} restore-keys: | expo-build-${{ runner.os }}- - name: Build Android env: DISK_CACHE_CACHE_DIR: node_modules/.expo-build-disk-cache DISK_CACHE_GC_TIME_DAYS: 3 run: npx expo run:android --no-install ``` -------------------------------- ### Configure Build Cache Provider in app.json (Expo SDK 54+) Source: https://context7.com/wookiefpv/expo-build-disk-cache/llms.txt Configures the plugin as the build cache provider within the app.json configuration file for Expo SDK 54 and later. This enables the disk caching functionality for native builds. ```jsonc // app.json or app.config.json (Expo SDK 54+) { "expo": { "name": "MyApp", "buildCacheProvider": { "plugin": "expo-build-disk-cache" } } } ``` -------------------------------- ### Configure Expo Build Disk Cache for SDK 54+ Source: https://github.com/wookiefpv/expo-build-disk-cache/blob/main/README.md This JSON configuration snippet enables the expo-build-disk-cache plugin for Expo SDK 54 and later. It should be added to your app's configuration file (e.g., app.json or app.config.js) to activate the build caching. ```json { "buildCacheProvider": { "plugin": "expo-build-disk-cache" } } ``` -------------------------------- ### Configure EAS Remote Caching in app.config.ts Source: https://context7.com/wookiefpv/expo-build-disk-cache/llms.txt This snippet demonstrates how to configure the expo-build-disk-cache plugin for EAS remote caching using the app.config.ts file. It utilizes the imported `buildDiskCacheProvider` function for a type-safe configuration. ```typescript // app.config.ts with EAS remote caching import { buildDiskCacheProvider } from "expo-build-disk-cache"; export default { name: "MyApp", slug: "my-app", buildCacheProvider: buildDiskCacheProvider({ remotePlugin: "eas", remoteOptions: { // EAS-specific options if needed }, }), }; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.