diff --git a/android/constants.gradle b/android/constants.gradle index c9d767818c..897c45ebab 100644 --- a/android/constants.gradle +++ b/android/constants.gradle @@ -7,6 +7,9 @@ project.ext { supportLibVersion = '28.0.0' googlePlayServicesVersion = '15.0.0' + // some native packages use firebaseVersion, some use firebaseCoreVersion + // in both, we want them to use these versions + firebaseVersion = '16.0.3' firebaseCoreVersion = '16.0.3' firebaseMessagingVersion = '17.6.0' } diff --git a/package.json b/package.json index 1952a6f358..3bd48e526f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@shoutem/platform", - "version": "2.2.1", + "version": "2.2.2", "scripts": { "start": "react-native start", "setup": "cd scripts && yarn install", @@ -9,7 +9,7 @@ "bundle": "node scripts/bundle", "build": "node scripts/build", "list-dependencies": "node scripts/platform-dependencies", - "jetify": "jetify" + "postinstall": "node scripts/postinstall" }, "dependencies": { "es6-symbol": "3.1.1", @@ -44,9 +44,7 @@ "eslint-plugin-react": "~7.12.4", "eslint-plugin-react-native": "~3.6.0", "jest": "^24.9.0", - "jetifier": "^1.6.5", "metro-react-native-babel-preset": "^0.56.0", - "patch-package": "6.2.0", "react-test-renderer": "16.8.6" }, "jest": { diff --git a/package.template.json b/package.template.json index 1952a6f358..3bd48e526f 100644 --- a/package.template.json +++ b/package.template.json @@ -1,6 +1,6 @@ { "name": "@shoutem/platform", - "version": "2.2.1", + "version": "2.2.2", "scripts": { "start": "react-native start", "setup": "cd scripts && yarn install", @@ -9,7 +9,7 @@ "bundle": "node scripts/bundle", "build": "node scripts/build", "list-dependencies": "node scripts/platform-dependencies", - "jetify": "jetify" + "postinstall": "node scripts/postinstall" }, "dependencies": { "es6-symbol": "3.1.1", @@ -44,9 +44,7 @@ "eslint-plugin-react": "~7.12.4", "eslint-plugin-react-native": "~3.6.0", "jest": "^24.9.0", - "jetifier": "^1.6.5", "metro-react-native-babel-preset": "^0.56.0", - "patch-package": "6.2.0", "react-test-renderer": "16.8.6" }, "jest": { diff --git a/platform/platform.json b/platform/platform.json index 098743a0cb..51b91a95c6 100644 --- a/platform/platform.json +++ b/platform/platform.json @@ -1,7 +1,7 @@ { - "version": "2.2.1", - "mobileAppVersion": "2.2.1", - "releaseNotes": "* Introduce navigation item text size change\n* Bugfixes and improvements", + "version": "2.2.2", + "mobileAppVersion": "2.2.2", + "releaseNotes": "* Introduce better and simpler patch-package support\n* Bugfixes and improvements", "settings": { "DEV-appetizeKey": "90dycv9gb098u6xytcb6jnkvw8", "QA-appetizeKey": "p0rrung10fm80qjkfzd8xyb11w", @@ -25,20 +25,20 @@ "shoutem.about": "~2.2.2", "shoutem.analytics": "~2.2.0", "shoutem.application": "~2.2.4", - "shoutem.audio": "~2.2.5", + "shoutem.audio": "~2.2.6", "shoutem.auth": "~2.2.5", "shoutem.books": "~2.2.3", "shoutem.camera": "~2.2.4", "shoutem.cms": "~2.2.3", "shoutem.code-push": "~2.2.0", - "shoutem.deals": "~2.2.4", + "shoutem.deals": "~2.2.6", "shoutem.events": "~2.2.2", "shoutem.favorites": "~2.2.2", "shoutem.flurry-analytics": "~2.2.1", "shoutem.i18n": "~2.2.0", "shoutem.ical-events": "~2.2.2", "shoutem.layouts": "~2.2.0", - "shoutem.loyalty": "~2.2.7", + "shoutem.loyalty": "~2.2.8", "shoutem.menu": "~2.2.2", "shoutem.navigation": "~2.2.3", "shoutem.news": "~2.2.2", diff --git a/scripts/classes/app-binary-configurator.js b/scripts/classes/app-binary-configurator.js index 6bcdf89eae..4f72ee4f3e 100644 --- a/scripts/classes/app-binary-configurator.js +++ b/scripts/classes/app-binary-configurator.js @@ -61,6 +61,7 @@ function downloadAndResizeImage(imageUrl, downloadPath, resizeConfig, production Jimp.read(imagePath) .then((imageFile) => imageFile + .rgba(!_.endsWith(image.savePath, 'marketing.png')) .cover(image.width, image.height) .write(image.savePath) ) diff --git a/scripts/postinstall.js b/scripts/postinstall.js new file mode 100644 index 0000000000..6aa337e205 --- /dev/null +++ b/scripts/postinstall.js @@ -0,0 +1,57 @@ +const { execSync } = require('child_process'); +const fs = require('fs-extra'); +const { prependProjectPath } = require('./helpers'); + +const NODE_MODULES_DIR = prependProjectPath('node_modules'); + +// returns all downloaded extensions found in the extensions directory +function fetchAllExtensions() { + const extensionsDir = prependProjectPath('extensions'); + + const listOfExtensions = fs.readdirSync( + prependProjectPath('extensions'), + { withFileTypes: true }, + ).filter(file => { + // Depending on the environment's OS, 'file' can be an object or just the + // name string, so we do an explicit check + if (typeof file === 'object' && file !== null) { + return fs.lstatSync(`${extensionsDir}/${file.name}`).isDirectory(); + } + + return fs.lstatSync(`${extensionsDir}/${file}`).isDirectory(); + }); + + return listOfExtensions; +} + +// use patch-package to apply patches provided by extensions +function applyExtensionPatches() { + const extensions = fetchAllExtensions(); + + if (!extensions.length) { + return; + } + + console.log("Checking for patch-package patches..."); + extensions.map((extension) => { + // Depending on the environment's OS, 'extension' can be an object or just + // the name string, so we do an explicit check + const extensionName = typeof extension === 'object' + ? extension.name : extension; + const patchPath = `node_modules/${extensionName}/patch`; + + if (!fs.existsSync(patchPath)) { + return; + } + + console.log(`[${extensionName}] - applying patches`) + return execSync(`npx patch-package --patch-dir ${patchPath}`); + }); + console.log("Applied all existing patches found.") +} + +applyExtensionPatches(); + +// use jetifier to update from android.support to androidx +console.log("Jetifying node_modules"); +execSync('npx jetifier');