Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: app minification #988

Merged
merged 14 commits into from
Mar 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -18,9 +18,12 @@ android {
}
buildTypes {
release {
minifyEnabled false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
}
}
}

3 changes: 2 additions & 1 deletion android/app/capacitor.build.gradle
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ dependencies {
implementation project(':aparajita-capacitor-biometric-auth')
implementation project(':capacitor-community-privacy-screen')
implementation project(':capacitor-community-sqlite')
implementation project(':capacitor-mlkit-barcode-scanning')
implementation project(':capacitor-app')
implementation project(':capacitor-browser')
implementation project(':capacitor-clipboard')
@@ -21,8 +22,8 @@ dependencies {
implementation project(':capacitor-share')
implementation project(':capacitor-splash-screen')
implementation project(':capacitor-status-bar')
implementation project(':capawesome-capacitor-android-edge-to-edge-support')
implementation project(':evva-capacitor-secure-storage-plugin')
implementation project(':capacitor-mlkit-barcode-scanning')
implementation project(':capacitor-native-settings')

}
57 changes: 44 additions & 13 deletions android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +1,52 @@
# Add project specific ProGuard rules here.
# Add project-specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Basic ProGuard rules for optimization and minification
-optimizationpasses 5
-dontpreverify
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
-renamesourcefileattribute SourceFile # Uncomment to hide original source file names for extra obfuscation

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
# Rules for WebView with JavaScript (if your app uses WebView)
-keepclassmembers class * {
@android.webkit.JavascriptInterface <methods>;
}
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
public *;
}
-dontwarn android.webkit.**

# Rules for Capacitor and its plugins
-keep class com.getcapacitor.** { *; }
-keep class org.apache.cordova.** { *; }
-dontwarn com.getcapacitor.**
-dontwarn org.apache.cordova.**

# Rules for specific dependencies from your package.json
-keep class androidx.** { *; }
-dontwarn androidx.**
-keep class com.google.android.material.** { *; }
-dontwarn com.google.android.material.**

# Rules for Capacitor plugins used in your project
-keep class com.aparajita.capacitor.biometricauth.** { *; }
-dontwarn com.aparajita.capacitor.biometricauth.**
-keep class com.capacitorjs.plugins.** { *; }
-dontwarn com.capacitorjs.plugins.**
-keep class io.evva.capacitor.securestorage.** { *; }
-dontwarn io.evva.capacitor.securestorage.**

# Suppress warnings from common libraries
-dontwarn com.google.**
-dontwarn org.chromium.**

# Keep annotated classes (useful for libraries like SQLite or MLKit)
-keep class * {
@androidx.annotation.Keep *;
}
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:8.7.2'
classpath 'com.google.gms:google-services:4.4.2'

classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.22'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
9 changes: 6 additions & 3 deletions android/capacitor.settings.gradle
Original file line number Diff line number Diff line change
@@ -11,6 +11,9 @@ project(':capacitor-community-privacy-screen').projectDir = new File('../node_mo
include ':capacitor-community-sqlite'
project(':capacitor-community-sqlite').projectDir = new File('../node_modules/@capacitor-community/sqlite/android')

include ':capacitor-mlkit-barcode-scanning'
project(':capacitor-mlkit-barcode-scanning').projectDir = new File('../node_modules/@capacitor-mlkit/barcode-scanning/android')

include ':capacitor-app'
project(':capacitor-app').projectDir = new File('../node_modules/@capacitor/app/android')

@@ -38,11 +41,11 @@ project(':capacitor-splash-screen').projectDir = new File('../node_modules/@capa
include ':capacitor-status-bar'
project(':capacitor-status-bar').projectDir = new File('../node_modules/@capacitor/status-bar/android')

include ':capawesome-capacitor-android-edge-to-edge-support'
project(':capawesome-capacitor-android-edge-to-edge-support').projectDir = new File('../node_modules/@capawesome/capacitor-android-edge-to-edge-support/android')

include ':evva-capacitor-secure-storage-plugin'
project(':evva-capacitor-secure-storage-plugin').projectDir = new File('../node_modules/@evva/capacitor-secure-storage-plugin/android')

include ':capacitor-mlkit-barcode-scanning'
project(':capacitor-mlkit-barcode-scanning').projectDir = new File('../node_modules/@capacitor-mlkit/barcode-scanning/android')

include ':capacitor-native-settings'
project(':capacitor-native-settings').projectDir = new File('../node_modules/capacitor-native-settings/android')
34 changes: 34 additions & 0 deletions ios/.gitignore
Original file line number Diff line number Diff line change
@@ -4,6 +4,40 @@ App/App/public
DerivedData
xcuserdata

# Pods config files
!App/Pods/Target Support Files/AparajitaCapacitorBiometricAuth/AparajitaCapacitorBiometricAuth.release.xcconfig
!App/Pods/Target Support Files/Capacitor/Capacitor.release.xcconfig
!App/Pods/Target Support Files/CapacitorApp/CapacitorApp.release.xcconfig
!App/Pods/Target Support Files/CapacitorBrowser/CapacitorBrowser.release.xcconfig
!App/Pods/Target Support Files/CapacitorClipboard/CapacitorClipboard.release.xcconfig
!App/Pods/Target Support Files/CapacitorCommunityPrivacyScreen/CapacitorCommunityPrivacyScreen.release.xcconfig
!App/Pods/Target Support Files/CapacitorCommunitySqlite/CapacitorCommunitySqlite.release.xcconfig
!App/Pods/Target Support Files/CapacitorCordova/CapacitorCordova.release.xcconfig
!App/Pods/Target Support Files/CapacitorDevice/CapacitorDevice.release.xcconfig
!App/Pods/Target Support Files/CapacitorKeyboard/CapacitorKeyboard.release.xcconfig
!App/Pods/Target Support Files/CapacitorMlkitBarcodeScanning/CapacitorMlkitBarcodeScanning.release.xcconfig
!App/Pods/Target Support Files/CapacitorNativeSettings/CapacitorNativeSettings.release.xcconfig
!App/Pods/Target Support Files/CapacitorScreenOrientation/CapacitorScreenOrientation.release.xcconfig
!App/Pods/Target Support Files/CapacitorShare/CapacitorShare.release.xcconfig
!App/Pods/Target Support Files/CapacitorSplashScreen/CapacitorSplashScreen.release.xcconfig
!App/Pods/Target Support Files/CapacitorStatusBar/CapacitorStatusBar.release.xcconfig
!App/Pods/Target Support Files/EvvaCapacitorSecureStoragePlugin/EvvaCapacitorSecureStoragePlugin.release.xcconfig
!App/Pods/Target Support Files/GoogleDataTransport/GoogleDataTransport.release.xcconfig
!App/Pods/Target Support Files/GoogleMLKit/GoogleMLKit.release.xcconfig
!App/Pods/Target Support Files/GoogleToolboxForMac/GoogleToolboxForMac.release.xcconfig
!App/Pods/Target Support Files/GoogleUtilities/GoogleUtilities.release.xcconfig
!App/Pods/Target Support Files/GTMSessionFetcher/GTMSessionFetcher.release.xcconfig
!App/Pods/Target Support Files/MLImage/MLImage.release.xcconfig
!App/Pods/Target Support Files/MLKitBarcodeScanning/MLKitBarcodeScanning.release.xcconfig
!App/Pods/Target Support Files/MLKitCommon/MLKitCommon.release.xcconfig
!App/Pods/Target Support Files/MLKitVision/MLKitVision.release.xcconfig
!App/Pods/Target Support Files/nanopb/nanopb.release.xcconfig
!App/Pods/Target Support Files/Pods-App/Pods-App.release.xcconfig
!App/Pods/Target Support Files/PromisesObjC/PromisesObjC.release.xcconfig
!App/Pods/Target Support Files/SimpleKeychain/SimpleKeychain.release.xcconfig
!App/Pods/Target Support Files/SQLCipher/SQLCipher.release.xcconfig
!App/Pods/Target Support Files/ZIPFoundation/ZIPFoundation.release.xcconfig

# Cordova plugins for Capacitor
capacitor-cordova-ios-plugins

5 changes: 4 additions & 1 deletion ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -320,11 +320,13 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = NO;
COPY_PHASE_STRIP = YES;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
@@ -335,6 +337,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
STRIP_STYLE = all;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
};
2 changes: 1 addition & 1 deletion ios/App/Podfile
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ def capacitor_pods
pod 'AparajitaCapacitorBiometricAuth', :path => '../../node_modules/@aparajita/capacitor-biometric-auth'
pod 'CapacitorCommunityPrivacyScreen', :path => '../../node_modules/@capacitor-community/privacy-screen'
pod 'CapacitorCommunitySqlite', :path => '../../node_modules/@capacitor-community/sqlite'
pod 'CapacitorMlkitBarcodeScanning', :path => '../../node_modules/@capacitor-mlkit/barcode-scanning'
pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app'
pod 'CapacitorBrowser', :path => '../../node_modules/@capacitor/browser'
pod 'CapacitorClipboard', :path => '../../node_modules/@capacitor/clipboard'
@@ -24,7 +25,6 @@ def capacitor_pods
pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen'
pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar'
pod 'EvvaCapacitorSecureStoragePlugin', :path => '../../node_modules/@evva/capacitor-secure-storage-plugin'
pod 'CapacitorMlkitBarcodeScanning', :path => '../../node_modules/@capacitor-mlkit/barcode-scanning'
pod 'CapacitorNativeSettings', :path => '../../node_modules/capacitor-native-settings'
end

2 changes: 1 addition & 1 deletion ios/App/Podfile.lock
Original file line number Diff line number Diff line change
@@ -195,6 +195,6 @@ SPEC CHECKSUMS:
SQLCipher: f2e96b3822e3006b379181a0e4fd145f6de29b56
ZIPFoundation: d170fa8e270b2a32bef9dcdcabff5b8f1a5deced

PODFILE CHECKSUM: 6f98d85c258c69db9c32f3aee44c5bc6a56e7858
PODFILE CHECKSUM: 4b0b310992defd8f1fb8755244de6cd31409f932

COCOAPODS: 1.16.2

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions ios/App/Pods/Target Support Files/MLImage/MLImage.release.xcconfig
18 changes: 18 additions & 0 deletions ios/App/Pods/Target Support Files/nanopb/nanopb.release.xcconfig
286 changes: 4 additions & 282 deletions package-lock.json
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -122,6 +122,7 @@
"sass": "^1.61.0",
"sass-loader": "^13.0.2",
"style-loader": "^3.3.1",
"terser-webpack-plugin": "^5.3.12",
"ts-jest": "^29.1.0",
"ts-json-schema-generator": "^2.3.0",
"ts-loader": "^9.4.2",
5 changes: 4 additions & 1 deletion webpack.dev.cjs
Original file line number Diff line number Diff line change
@@ -52,5 +52,8 @@ module.exports = merge(require("./webpack.common.cjs"), {
});
}
},
]
],
optimization: {
minimize: false,
},
});
8 changes: 8 additions & 0 deletions webpack.prod.cjs
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ const WorkboxPlugin = require('workbox-webpack-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
let { merge } = require("webpack-merge");
const TerserPlugin = require("terser-webpack-plugin");

module.exports = merge(require("./webpack.common.cjs"), {
mode: "production",
@@ -52,6 +53,13 @@ module.exports = merge(require("./webpack.common.cjs"), {
],
optimization: {
minimizer: [
new TerserPlugin({
extractComments: false,
terserOptions: {
compress: true,
mangle: true,
},
}),
new CssMinimizerPlugin()
],
minimize: true,
Loading