From 35a61ff6194e73fb2ab3098c0ec3daf8fa6312b6 Mon Sep 17 00:00:00 2001 From: Mathieu Acthernoene Date: Fri, 17 Feb 2023 13:28:52 +0100 Subject: [PATCH] Update config key --- example/package.json | 2 +- react-native.config.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/example/package.json b/example/package.json index 6b1ce137..c872b40c 100644 --- a/example/package.json +++ b/example/package.json @@ -23,7 +23,7 @@ "node" ] }, - "iosPermissions": [ + "reactNativePermissionsIOS": [ "AppTrackingTransparency", "BluetoothPeripheral", "Calendars", diff --git a/react-native.config.js b/react-native.config.js index ddc6200c..4b72b441 100644 --- a/react-native.config.js +++ b/react-native.config.js @@ -3,6 +3,8 @@ const fs = require('fs/promises'); const path = require('path'); const pc = require('picocolors'); +const CONFIG_KEY = 'reactNativePermissionsIOS'; + const log = { error: (text) => console.log(pc.red(text)), warning: (text) => console.log(pc.yellow(text)), @@ -15,12 +17,12 @@ module.exports = { description: 'Update react-native-permissions podspec to link additional permission handlers.', func: async () => { - const explorer = await cosmiconfig('iosPermissions'); + const explorer = await cosmiconfig(CONFIG_KEY); const result = await explorer.search(); if (!result) { log.error( - 'No config detected. In order to setup iOS permissions, you first need to add an "iosPermissions" array in your package.json.', + `No config detected. In order to setup iOS permissions, you first need to add an "${CONFIG_KEY}" array in your package.json.`, ); process.exit(1); @@ -29,7 +31,7 @@ module.exports = { const {config} = result; if (!Array.isArray(config) || config.length === 0) { - log.error('Invalid "iosPermissions" config detected. It must be a non-empty array.'); + log.error(`Invalid "${CONFIG_KEY}" config detected. It must be a non-empty array.`); process.exit(1); }