expo-keystore-manager
Version:
A comprehensive Expo config plugin for managing Android release keystore configuration
62 lines • 2.71 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const withKeystore_1 = __importDefault(require("./withKeystore"));
const withKeystoreValidation_1 = __importDefault(require("./withKeystoreValidation"));
const withProguardConfig_1 = __importDefault(require("./withProguardConfig"));
/**
* Complete Expo Release Keystore Manager Plugin
*
* This plugin handles all aspects of Android release keystore configuration:
* - Validates keystore configuration
* - Sets up Gradle properties for signing
* - Configures app/build.gradle with signing configs
* - Optionally sets up ProGuard/R8 for code obfuscation
*
* @param {Object} config - Expo config object
* @param {Object} options - Keystore configuration options
* @param {string} options.keystoreFile - Path to keystore file (required)
* @param {string} options.keystorePassword - Keystore password (required)
* @param {string} options.keyAlias - Key alias (required)
* @param {string} options.keyPassword - Key password (required)
* @param {string} [options.storeType="JKS"] - Keystore type (JKS, PKCS12, BKS)
* @param {boolean} [options.enableProguard=true] - Enable ProGuard/R8 minification
* @param {boolean} [options.enableR8=true] - Enable R8 optimization
* @param {string} [options.customProguardRules] - Custom ProGuard rules
* @returns {Object} Modified Expo config
*/
const withKeystoreManager = (config, options = {
keystoreFile: "",
keystorePassword: "",
keyAlias: "",
keyPassword: "",
storeType: "JKS",
enableProguard: true,
enableR8: true,
customProguardRules: "",
}) => {
if (!options || Object.keys(options).length === 0) {
console.warn("⚠️ No keystore options provided to expo-keystore-manager plugin.\n" +
" The plugin will be skipped. Please provide keystore configuration.");
return config;
}
try {
// Step 1: Validate keystore configuration
config = (0, withKeystoreValidation_1.default)(config, options);
// Step 2: Configure keystore signing
config = (0, withKeystore_1.default)(config, options);
// Step 3: Configure ProGuard if enabled
config = (0, withProguardConfig_1.default)(config, options);
}
catch (error) {
console.error("❌ Error configuring release keystore:", error.message);
throw error;
}
return config;
};
// Export utilities for advanced usage
withKeystoreManager.utils = require("./withKeystoreUtils");
exports.default = withKeystoreManager;
//# sourceMappingURL=index.js.map
;