diff --git a/hooks/after_prepare/061_copy_build_extras.js b/hooks/after_prepare/061_copy_build_extras.js index 453488e5af77affb9a15402df5bb545b1c94b546..695523cdd83dfa485172b8eacc3ab3f27c653288 100755 --- a/hooks/after_prepare/061_copy_build_extras.js +++ b/hooks/after_prepare/061_copy_build_extras.js @@ -1,31 +1,31 @@ #!/usr/bin/env node "use strict"; -var fs = require('fs'); -var glob = require('glob'); -var path = require('path') +const fs = require('fs'), + glob = require('glob'), + path = require('path'); // See: https://stackoverflow.com/questions/49162538/running-cordova-build-android-unable-to-find-attribute-androidfontvariation -var rootdir = process.argv[2]; +const rootdir = process.argv[2]; if (rootdir) { -// go through each of the platform directories that have been prepared - var platforms = (process.env.CORDOVA_PLATFORMS ? process.env.CORDOVA_PLATFORMS.split(',') : []); + // go through each of the platform directories that have been prepared + const platforms = (process.env.CORDOVA_PLATFORMS ? process.env.CORDOVA_PLATFORMS.split(',') : []); - for (var x = 0; x < platforms.length; x++) { + for (let x = 0; x < platforms.length; x++) { try { - var platform = platforms[x].trim().toLowerCase(); + const platform = platforms[x].trim().toLowerCase(); if (platform === 'android') { - var build_dir = rootdir + '/resources/android/build'; - var android_dir = rootdir + '/platforms/android'; - var build_files = build_dir + '/**/*.*'; + const build_dir = rootdir + '/resources/android/build'; + const android_dir = rootdir + '/platforms/android'; + const build_files = build_dir + '/**/*.*'; console.log('-----------------------------------------'); if (fs.existsSync(android_dir) && fs.existsSync(build_dir)) { - var mkdirp = function(dir) { - var parent = path.dirname(dir); + const mkdirp = function(dir) { + const parent = path.dirname(dir); if (!fs.existsSync(parent)){ mkdirp(parent); } @@ -37,18 +37,18 @@ if (rootdir) { glob(build_files, null, function(er, files) { files.forEach(function(file) { console.log(' Copy ' + file + ' to ' + android_dir); - var dest_file = file.replace(build_dir, android_dir); + const dest_file = file.replace(build_dir, android_dir); mkdirp(path.dirname(dest_file)); fs.createReadStream(file).pipe(fs.createWriteStream(dest_file)); }); }); - var gradle_file = build_dir + '/build-extras.gradle'; + const gradle_file = build_dir + '/build-extras.gradle'; if (!fs.existsSync(gradle_file)) { console.log( ' File ' + gradle_file + ' not found. Skipping copy to /platforms/android'); } - var signing_file = build_dir + '/release-signing.properties'; + const signing_file = build_dir + '/release-signing.properties'; if (!fs.existsSync(signing_file)) { console.log( ' File ' + signing_file + ' not found. Skipping copy to /platforms/android'); console.log( ' WARNING: Release APK files will not be signed !');