expo-keystore-manager
Version:
A comprehensive Expo config plugin for managing Android release keystore configuration
40 lines • 1.7 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
/**
* Validates keystore configuration and file existence
*/
const withKeystoreValidation = (config, options) => {
// Validate required options
const requiredFields = [
"keystoreFile",
"keystorePassword",
"keyAlias",
"keyPassword",
];
const missingFields = requiredFields.filter((field) => !options[field]);
if (missingFields.length > 0) {
throw new Error(`Missing required keystore configuration fields: ${missingFields.join(", ")}`);
}
// Validate keystore file exists if it's a relative path
if (options.keystoreFile && !options.keystoreFile.startsWith("/")) {
const keystorePath = path_1.default.resolve(process.cwd(), options.keystoreFile);
if (!fs_1.default.existsSync(keystorePath)) {
console.warn(`⚠️ Keystore file not found at: ${keystorePath}\n` +
` Make sure to place your keystore file at this location before building.`);
}
}
// Validate store type
const validStoreTypes = ["JKS", "PKCS12", "BKS"];
if (options.storeType &&
!validStoreTypes.includes(options.storeType.toUpperCase())) {
throw new Error(`Invalid storeType: ${options.storeType}. Valid types are: ${validStoreTypes.join(", ")}`);
}
return config;
};
exports.default = withKeystoreValidation;
//# sourceMappingURL=withKeystoreValidation.js.map
;