UNPKG

@react-native-firebase/app

Version:

A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Admob, Analytics, Auth, Crash Reporting, Cloud Firestore, Database, Dynamic Links, Functions, Messaging (FCM), Remote Config, Sto

34 lines (33 loc) 1.54 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.withCopyAndroidGoogleServices = void 0; const config_plugins_1 = require("@expo/config-plugins"); const constants_1 = require("./constants"); const path_1 = __importDefault(require("path")); const fs_1 = __importDefault(require("fs")); /** * Copy `google-services.json` */ const withCopyAndroidGoogleServices = config => { return (0, config_plugins_1.withDangerousMod)(config, [ 'android', async (config) => { if (!config.android?.googleServicesFile) { throw new Error('Path to google-services.json is not defined. Please specify the `expo.android.googleServicesFile` field in app.json.'); } const srcPath = path_1.default.resolve(config.modRequest.projectRoot, config.android.googleServicesFile); const destPath = path_1.default.resolve(config.modRequest.platformProjectRoot, constants_1.DEFAULT_TARGET_PATH); try { await fs_1.default.promises.copyFile(srcPath, destPath); } catch (_) { throw new Error(`Cannot copy google-services.json, because the file ${srcPath} doesn't exist. Please provide a valid path in \`app.json\`.`); } return config; }, ]); }; exports.withCopyAndroidGoogleServices = withCopyAndroidGoogleServices;