@interopio/desktop-cli
Version:
io.Connect Desktop Seed Repository CLI Tools
102 lines • 7.28 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.platformCommand = void 0;
const commander_1 = require("commander");
const utils_1 = require("../utils");
const chalk_1 = __importDefault(require("chalk"));
const os_1 = __importDefault(require("os"));
exports.platformCommand = new commander_1.Command('platform')
.description('Show platform and cross-compilation information')
.action(async () => {
try {
console.log('\n' + chalk_1.default.cyan('Platform Information:'));
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
// Current platform info
console.log(chalk_1.default.bold('\nCurrent Environment:'));
console.log(` Platform: ${chalk_1.default.green(process.platform)} (${getOSDisplayName(process.platform)})`);
console.log(` Architecture: ${chalk_1.default.green(process.arch)}`);
console.log(` Node.js: ${chalk_1.default.green(process.version)}`);
console.log(` OS: ${chalk_1.default.green(os_1.default.type())} ${os_1.default.release()}`);
// Supported platforms
console.log(chalk_1.default.bold('\nSupported Target Platforms:'));
const platforms = [
{ id: 'win32', name: 'Windows', archs: ['x64', 'arm64'], emoji: '🪟' },
{ id: 'darwin', name: 'macOS', archs: ['x64', 'arm64'], emoji: '🍎' },
{ id: 'linux', name: 'Linux', archs: ['x64', 'arm64'], emoji: '🐧' }
];
platforms.forEach(platform => {
const isCurrent = platform.id === process.platform;
const marker = isCurrent ? chalk_1.default.green('● (current)') : chalk_1.default.gray('○');
console.log(` ${marker} ${platform.emoji} ${platform.name} (${platform.id})`);
console.log(` Architectures: ${platform.archs.map(arch => arch === process.arch && isCurrent
? chalk_1.default.green(arch + ' (current)')
: chalk_1.default.gray(arch)).join(', ')}`);
});
// Cross-compilation commands
console.log(chalk_1.default.bold('\nSetup Commands:'));
console.log(` ${chalk_1.default.cyan('npx iocd setup')} - Setup for current platform (${process.platform})`);
console.log(` ${chalk_1.default.cyan('npx iocd setup --arch arm64')} - Setup for ARM64 architecture`);
console.log(chalk_1.default.bold('\nPackaging Commands (Cross-Platform):'));
console.log(` ${chalk_1.default.cyan('npm run package')} - Package for current platform`);
console.log(` ${chalk_1.default.cyan('npm run package:win')} - Package for Windows ${process.platform !== 'win32' ? chalk_1.default.yellow('(unsigned)') : chalk_1.default.green('(can sign)')}`);
console.log(` ${chalk_1.default.cyan('npm run package:mac')} - Package for macOS ${process.platform !== 'darwin' ? chalk_1.default.yellow('(unsigned)') : chalk_1.default.green('(can sign)')}`);
console.log(` ${chalk_1.default.cyan('npm run package:linux')} - Package for Linux ${chalk_1.default.green('(works from any platform)')}`);
console.log(` ${chalk_1.default.cyan('npx iocd package --platform win --arch x64')} - Package for specific platform/arch`);
console.log(chalk_1.default.bold('\nComponent Management:'));
console.log(` ${chalk_1.default.cyan('npx iocd component install')} - Install components for current platform`);
console.log(` ${chalk_1.default.cyan('npx iocd component list')} - List installed components`);
console.log(` ${chalk_1.default.cyan('npx iocd component all')} - List all available components`);
// Cross-compilation notes
console.log(chalk_1.default.bold('\nCross-Platform Packaging Capabilities:'));
const currentPlatform = process.platform;
console.log(`\nFrom ${chalk_1.default.green(getOSDisplayName(currentPlatform))} you can build:`);
if (currentPlatform === 'win32') {
console.log(` ${chalk_1.default.green('✓')} Windows - Full support (native, code signing)`);
console.log(` ${chalk_1.default.green('✓')} Linux - Good support (AppImage, deb, rpm)`);
console.log(` ${chalk_1.default.yellow('⚠')} macOS - Limited (unsigned .app only, no signing/notarization)`);
}
else if (currentPlatform === 'darwin') {
console.log(` ${chalk_1.default.green('✓')} macOS - Full support (native, code signing, notarization)`);
console.log(` ${chalk_1.default.green('✓')} Windows - Good support (unsigned exe, msi)`);
console.log(` ${chalk_1.default.green('✓')} Linux - Good support (AppImage, deb, rpm)`);
}
else if (currentPlatform === 'linux') {
console.log(` ${chalk_1.default.green('✓')} Linux - Full support (native, all formats)`);
console.log(` ${chalk_1.default.green('✓')} Windows - Good support (unsigned exe, msi)`);
console.log(` ${chalk_1.default.yellow('⚠')} macOS - Limited (unsigned .app only, no signing/notarization)`);
}
console.log(chalk_1.default.bold('\nProduction Recommendations:'));
console.log(' • Windows signing: Use Windows machine or Windows CI runner');
console.log(' • macOS signing/notarization: Requires macOS machine or macOS CI runner');
console.log(' • Linux: Can be built and signed from any platform');
console.log(' • For CI/CD: Use platform-specific runners for signing');
console.log(chalk_1.default.bold('\nCross-Platform Development Workflow:'));
console.log(' • Setup and develop on your current platform only');
console.log(' • Test packaging locally for all platforms (development builds)');
console.log(' • Use CI/CD with multiple runners for production builds with signing');
console.log(' • electron-builder handles cross-compilation automatically');
// Environment variables
console.log(chalk_1.default.bold('\nRelevant Environment Variables:'));
console.log(' • IOCD_REGISTRY_URL - Component registry URL');
console.log(' • IOCD_CACHE_ENABLED - Enable component download cache');
console.log(' • HTTP_PROXY / HTTPS_PROXY - Proxy configuration');
console.log(' • NODE_TLS_REJECT_UNAUTHORIZED - SSL certificate validation');
console.log('');
}
catch (error) {
utils_1.Logger.error(`Failed to show platform information: ${error instanceof Error ? error.message : String(error)}`);
process.exit(1);
}
});
function getOSDisplayName(platform) {
switch (platform) {
case 'win32': return 'Windows';
case 'darwin': return 'macOS';
case 'linux': return 'Linux';
default: return platform;
}
}
//# sourceMappingURL=platform.js.map