cordova-plugin-androidx
Advanced tools
Comparing version 1.0.2 to 2.0.0
{ | ||
"name": "cordova-plugin-androidx", | ||
"version": "1.0.2", | ||
"version": "2.0.0", | ||
"description": "Cordova/Phonegap plugin to enable AndroidX", | ||
"author": "Dave Alden", | ||
"license": "MIT", | ||
"dependencies": { | ||
"q": "^1.4.1" | ||
"repository": "dpa99c/cordova-plugin-androidx", | ||
"bugs": { | ||
"url": "https://github.com/dpa99c/cordova-plugin-androidx/issues" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": {} | ||
} |
@@ -6,8 +6,15 @@ cordova-plugin-androidx | ||
This plugin is useful if your project contains plugins which have migrated to AndroidX or if you otherwise want to enable AndroidX in your Cordova Android platform project. | ||
This plugin is useful if your project contains plugins which have migrated to AndroidX or if you otherwise want to enable AndroidX in your Cordova Android platform project. | ||
<!-- DONATE --> | ||
[![donate](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG_global.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZRD3W47HQ3EMJ) | ||
I dedicate a considerable amount of my free time to developing and maintaining this Cordova plugin, along with my other Open Source software. | ||
To help ensure this plugin is kept updated, new features are added and bugfixes are implemented quickly, please donate a couple of dollars (or a little more if you can stretch) as this will help me to afford to dedicate time to its maintenance. Please consider donating if you're using this plugin in an app that makes you money, if you're being paid to make the app, if you're asking for new features or priority bug fixes. | ||
<!-- END DONATE --> | ||
# Requirements | ||
This plugin requires a minimum of [`cordova@9`](https://github.com/apache/cordova-cli) and [`cordova-android@8`](https://github.com/apache/cordova-android). | ||
This plugin requires a minimum of [`cordova@8`](https://github.com/apache/cordova-cli) and [`cordova-android@8`](https://github.com/apache/cordova-android). | ||
@@ -14,0 +21,0 @@ # Installation |
@@ -1,7 +0,7 @@ | ||
var PLUGIN_NAME = "cordova-plugin-androidx"; | ||
var enableAndroidX = "android.useAndroidX=true"; | ||
var enableJetifier = "android.enableJetifier=true"; | ||
var gradlePropertiesPath = "./platforms/android/gradle.properties"; | ||
const fs = require('fs'); | ||
var deferral, fs, path; | ||
const PLUGIN_NAME = "cordova-plugin-androidx"; | ||
const enableAndroidX = "android.useAndroidX=true"; | ||
const enableJetifier = "android.enableJetifier=true"; | ||
const gradlePropertiesPath = "./platforms/android/gradle.properties"; | ||
@@ -14,56 +14,37 @@ function log(message) { | ||
log("ERROR: " + error); | ||
deferral.resolve(); | ||
} | ||
function run() { | ||
try { | ||
fs = require('fs'); | ||
path = require('path'); | ||
} catch (e) { | ||
throw("Failed to load dependencies: " + e.toString()); | ||
} | ||
let gradleProperties = fs.readFileSync(gradlePropertiesPath); | ||
var gradleProperties = fs.readFileSync(gradlePropertiesPath); | ||
if (gradleProperties) { | ||
var updatedGradleProperties = false; | ||
let updatedGradleProperties = false; | ||
gradleProperties = gradleProperties.toString(); | ||
if(!gradleProperties.match(enableAndroidX)){ | ||
if (!gradleProperties.match(enableAndroidX)) { | ||
gradleProperties += "\n" + enableAndroidX; | ||
updatedGradleProperties = true; | ||
} | ||
if(!gradleProperties.match(enableJetifier)){ | ||
if (!gradleProperties.match(enableJetifier)) { | ||
gradleProperties += "\n" + enableJetifier; | ||
updatedGradleProperties = true; | ||
} | ||
if(updatedGradleProperties){ | ||
if (updatedGradleProperties) { | ||
fs.writeFileSync(gradlePropertiesPath, gradleProperties, 'utf8'); | ||
log("Updated gradle.properties to enable AndroidX"); | ||
} | ||
}else{ | ||
} else { | ||
log("gradle.properties file not found!") | ||
} | ||
deferral.resolve(); | ||
} | ||
function attempt(fn) { | ||
return function () { | ||
module.exports = function () { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
fn.apply(this, arguments); | ||
run(); | ||
resolve(); | ||
} catch (e) { | ||
onError("EXCEPTION: " + e.toString()); | ||
reject(e); | ||
} | ||
} | ||
} | ||
module.exports = function (ctx) { | ||
try{ | ||
deferral = require('q').defer(); | ||
}catch(e){ | ||
e.message = 'Unable to load node module dependency \'q\': '+e.message; | ||
log(e.message); | ||
throw e; | ||
} | ||
attempt(run)(); | ||
return deferral.promise; | ||
}); | ||
}; |
Sorry, the diff of this file is not supported yet
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
5917
0
0
56
43