@@ -12,6 +12,25 @@ const fs = require("node:fs");
1212const path = require ( "node:path" ) ;
1313const PLATFORM_FILES = [ ".DS_Store" ] ;
1414const PACKAGE_MANAGERS = new Set ( [ "bun" , "npm" , "pnpm" , "yarn" ] ) ;
15+ const ID_PAID = "com.foxdebug.acode" ;
16+ const ADMOB_PLUGIN_DIR = "admob" ;
17+
18+ function isPaidVersion ( ) {
19+ const configPath = path . join ( __dirname , "../config.xml" ) ;
20+ let config ;
21+
22+ try {
23+ config = fs . readFileSync ( configPath , "utf8" ) ;
24+ } catch ( error ) {
25+ throw new Error ( `Unable to read config.xml at ${ configPath } .` , {
26+ cause : error ,
27+ } ) ;
28+ }
29+
30+ const widgetId = / < w i d g e t [ ^ > ] * \s i d = [ " ' ] ( [ ^ " ' ] + ) [ " ' ] / . exec ( config ) ?. [ 1 ] ;
31+
32+ return widgetId === ID_PAID ;
33+ }
1534
1635function getPackageManager ( ) {
1736 const userAgent = process . env . npm_config_user_agent ;
@@ -61,8 +80,10 @@ execSync("cordova plugin add cordova-plugin-buildinfo", { stdio: "inherit" });
6180execSync ( "cordova plugin add cordova-plugin-device" , { stdio : "inherit" } ) ;
6281execSync ( "cordova plugin add cordova-plugin-file" , { stdio : "inherit" } ) ;
6382
83+ const shouldSkipAdmob = isPaidVersion ( ) ;
6484const plugins = fs . readdirSync ( path . join ( __dirname , "../src/plugins" ) ) ;
6585plugins . forEach ( ( plugin ) => {
6686 if ( PLATFORM_FILES . includes ( plugin ) || plugin . startsWith ( "." ) ) return ;
87+ if ( shouldSkipAdmob && plugin === ADMOB_PLUGIN_DIR ) return ;
6788 execSync ( `cordova plugin add ./src/plugins/${ plugin } ` , { stdio : "inherit" } ) ;
6889} ) ;
0 commit comments